mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-01 20:29:24 +01:00
* fixed handling of unaligned in assignments
git-svn-id: trunk@9302 -
This commit is contained in:
parent
d568718cb0
commit
3b4eba9f86
@ -693,7 +693,11 @@ implementation
|
||||
len:=left.resultdef.size;
|
||||
if (right.location.reference.offset mod sizeof(aint)<>0) or
|
||||
(left.location.reference.offset mod sizeof(aint)<>0) or
|
||||
(right.resultdef.alignment<sizeof(aint)) then
|
||||
(right.resultdef.alignment<sizeof(aint)) or
|
||||
((right.location.reference.alignment<>0) and
|
||||
(right.location.reference.alignment<sizeof(aint))) or
|
||||
((left.location.reference.alignment<>0) and
|
||||
(left.location.reference.alignment<sizeof(aint))) then
|
||||
cg.g_concatcopy_unaligned(current_asmdata.CurrAsmList,right.location.reference,left.location.reference,len)
|
||||
else
|
||||
cg.g_concatcopy(current_asmdata.CurrAsmList,right.location.reference,left.location.reference,len);
|
||||
|
||||
@ -2144,6 +2144,7 @@ begin
|
||||
|
||||
{$ifdef SUPPORT_UNALIGNED}
|
||||
def_system_macro('FPC_SUPPORTS_UNALIGNED');
|
||||
def_system_macro('FPC_UNALIGNED_FIXED');
|
||||
{$endif SUPPORT_UNALIGNED}
|
||||
{$ifdef powerpc64}
|
||||
def_system_macro('FPC_HAS_LWSYNC');
|
||||
|
||||
@ -588,14 +588,14 @@ begin
|
||||
result:=0;
|
||||
exit;
|
||||
end;
|
||||
{$ifdef FPC_SUPPORTS_UNALIGNED}
|
||||
{$ifdef FPC_UNALIGNED_FIXED}
|
||||
if bufsize-bufidx>=sizeof(word) then
|
||||
begin
|
||||
result:=Unaligned(pword(@buf[bufidx])^);
|
||||
result:=Unaligned(pword(@buf[bufidx]))^;
|
||||
inc(bufidx,sizeof(word));
|
||||
end
|
||||
else
|
||||
{$endif FPC_SUPPORTS_UNALIGNED}
|
||||
{$endif FPC_UNALIGNED_FIXED}
|
||||
readdata(result,sizeof(word));
|
||||
if change_endian then
|
||||
result:=swapendian(result);
|
||||
@ -611,14 +611,14 @@ begin
|
||||
getlongint:=0;
|
||||
exit;
|
||||
end;
|
||||
{$ifdef FPC_SUPPORTS_UNALIGNED}
|
||||
{$ifdef FPC_UNALIGNED_FIXED}
|
||||
if bufsize-bufidx>=sizeof(longint) then
|
||||
begin
|
||||
result:=Unaligned(plongint(@buf[bufidx])^);
|
||||
result:=Unaligned(plongint(@buf[bufidx]))^;
|
||||
inc(bufidx,sizeof(longint));
|
||||
end
|
||||
else
|
||||
{$endif FPC_SUPPORTS_UNALIGNED}
|
||||
{$endif FPC_UNALIGNED_FIXED}
|
||||
readdata(result,sizeof(longint));
|
||||
if change_endian then
|
||||
result:=swapendian(result);
|
||||
@ -634,14 +634,14 @@ begin
|
||||
result:=0;
|
||||
exit;
|
||||
end;
|
||||
{$ifdef FPC_SUPPORTS_UNALIGNED}
|
||||
{$ifdef FPC_UNALIGNED_FIXED}
|
||||
if bufsize-bufidx>=sizeof(int64) then
|
||||
begin
|
||||
result:=Unaligned(pint64(@buf[bufidx])^);
|
||||
inc(bufidx,sizeof(int64));
|
||||
end
|
||||
else
|
||||
{$endif FPC_SUPPORTS_UNALIGNED}
|
||||
{$endif FPC_UNALIGNED_FIXED}
|
||||
readdata(result,sizeof(int64));
|
||||
if change_endian then
|
||||
result:=swapendian(result);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user