Jelajahi Sumber

+ test for keeping small records in registers

git-svn-id: trunk@2549 -
Jonas Maebe 19 tahun lalu
induk
melakukan
a3a0cf098a
2 mengubah file dengan 39 tambahan dan 0 penghapusan
  1. 1 0
      .gitattributes
  2. 38 0
      tests/test/opt/treg4.pp

+ 1 - 0
.gitattributes

@@ -5581,6 +5581,7 @@ tests/test/opt/treg1.pp svneol=native#text/plain
 tests/test/opt/treg2.dat -text
 tests/test/opt/treg2.pp svneol=native#text/plain
 tests/test/opt/treg3.pp svneol=native#text/plain
+tests/test/opt/treg4.pp svneol=native#text/plain
 tests/test/tabstrcl.pp svneol=native#text/plain
 tests/test/talign.pp svneol=native#text/plain
 tests/test/talign1.pp svneol=native#text/plain

+ 38 - 0
tests/test/opt/treg4.pp

@@ -0,0 +1,38 @@
+{$inline on}
+{$mode objfpc}
+
+type
+  tr = record
+    case byte of
+      1: (l: longint);
+      2: (b1,b2,b3,b4: byte);
+  end;
+
+function f: tr; inline;
+begin
+  f.l := 5;
+  f.b3 := 6;
+end;
+
+procedure t(const r1: tr);
+begin
+  if (r1.b3 <> 6) or
+     ((r1.l and 255) <> 5) then
+    halt(1);
+end;
+
+procedure t2(out r: tr);
+begin
+  r.l := 7;
+  r.b2 := 31;
+end;
+
+var
+  r: tr;
+begin
+  t(f);
+  t2(r);
+  if ((r.l and 255) <> 7) or
+     (r.b2 <> 31) then
+    halt(1);
+end.