mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-10 05:46:14 +02:00
Fix bug report #39952.
* compiler/aggas.pas: Avoid use of .long for 64bit constant for targets that automatically insert alignments. + tests/webtbs/tw39952.pp: New test from bug report 39952.
This commit is contained in:
parent
f0c0d8a033
commit
d217a459aa
@ -1050,7 +1050,10 @@ implementation
|
||||
internalerror(200404292);
|
||||
if not(target_info.system in systems_aix) then
|
||||
begin
|
||||
writer.AsmWrite(ait_const2str[aitconst_32bit]);
|
||||
if (target_info.system in use_ua_elf_systems) then
|
||||
writer.AsmWrite(ait_ua_elf_const2str[aitconst_32bit])
|
||||
else
|
||||
writer.AsmWrite(ait_const2str[aitconst_32bit]);
|
||||
if target_info.endian = endian_little then
|
||||
begin
|
||||
writer.AsmWrite(tostr(longint(lo(tai_const(hp).value))));
|
||||
|
70
tests/webtbs/tw39952.pp
Normal file
70
tests/webtbs/tw39952.pp
Normal file
@ -0,0 +1,70 @@
|
||||
|
||||
const
|
||||
REC_SIZE=3;
|
||||
|
||||
type
|
||||
tinst = packed record
|
||||
x : word;
|
||||
b : byte;
|
||||
rec : array[1..REC_SIZE] of int64;
|
||||
end;
|
||||
|
||||
const
|
||||
x_val = 45634;
|
||||
b_val = 56;
|
||||
rec1_val = $123456;
|
||||
rec2_val = $DCBA87654321;
|
||||
rec3_val = $ADEFCB4567;
|
||||
t : tinst = (
|
||||
x : x_val;
|
||||
b : b_val;
|
||||
rec : (rec1_val,rec2_val,rec3_val)
|
||||
);
|
||||
|
||||
|
||||
var
|
||||
i : longint;
|
||||
const
|
||||
has_errors : boolean = false;
|
||||
|
||||
begin
|
||||
writeln('t.x=',t.x);
|
||||
writeln('t.b=',t.b);
|
||||
for i:=1 to REC_SIZE do
|
||||
writeln('t.rec[',i,']=',t.rec[i]);
|
||||
if (t.x <> x_val) then
|
||||
begin
|
||||
writeln('t.x field is wrong');
|
||||
has_errors:=true;
|
||||
end;
|
||||
|
||||
if (t.b <> b_val) then
|
||||
begin
|
||||
writeln('t.b field is wrong');
|
||||
has_errors:=true;
|
||||
end;
|
||||
|
||||
if (t.rec[1] <> rec1_val) then
|
||||
begin
|
||||
writeln('t.rec[1] field is wrong');
|
||||
has_errors:=true;
|
||||
end;
|
||||
|
||||
if (t.rec[2] <> rec2_val) then
|
||||
begin
|
||||
writeln('t.rec2 field is wrong');
|
||||
has_errors:=true;
|
||||
end;
|
||||
|
||||
if (t.rec[3] <> rec3_val) then
|
||||
begin
|
||||
writeln('t.rec[3] field is wrong');
|
||||
has_errors:=true;
|
||||
end;
|
||||
|
||||
if has_errors then
|
||||
begin
|
||||
writeln('Wrong code is generated');
|
||||
halt(1);
|
||||
end;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user