2
0
Эх сурвалжийг харах

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.

(cherry picked from commit d217a459aac3cc2ec2792045ea7f27bc042bc789)

Pierre Muller 2 жил өмнө
parent
commit
7b2f6871ff

+ 4 - 1
compiler/aggas.pas

@@ -942,7 +942,10 @@ implementation
                         internalerror(200404292);
                         internalerror(200404292);
                       if not(target_info.system in systems_aix) then
                       if not(target_info.system in systems_aix) then
                         begin
                         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
                           if target_info.endian = endian_little then
                             begin
                             begin
                               writer.AsmWrite(tostr(longint(lo(tai_const(hp).value))));
                               writer.AsmWrite(tostr(longint(lo(tai_const(hp).value))));

+ 70 - 0
tests/webtbs/tw39952.pp

@@ -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.