Преглед на файлове

* we have to be able to take the address of an "absolute" variable
expression (necessary to, a.o., reject absolute mappings to fields
of bitpacked records and to bitpacked array elements)

git-svn-id: trunk@12874 -

Jonas Maebe преди 16 години
родител
ревизия
c4bedeb9df
променени са 3 файла, в които са добавени 17 реда и са изтрити 0 реда
  1. 1 0
      .gitattributes
  2. 4 0
      compiler/pdecvar.pas
  3. 12 0
      tests/test/tprec24.pp

+ 1 - 0
.gitattributes

@@ -7939,6 +7939,7 @@ tests/test/tprec20.pp svneol=native#text/plain
 tests/test/tprec21.pp svneol=native#text/plain
 tests/test/tprec21.pp svneol=native#text/plain
 tests/test/tprec22.pp svneol=native#text/plain
 tests/test/tprec22.pp svneol=native#text/plain
 tests/test/tprec23.pp svneol=native#text/plain
 tests/test/tprec23.pp svneol=native#text/plain
+tests/test/tprec24.pp svneol=native#text/plain
 tests/test/tprec3.pp svneol=native#text/plain
 tests/test/tprec3.pp svneol=native#text/plain
 tests/test/tprec4.pp svneol=native#text/plain
 tests/test/tprec4.pp svneol=native#text/plain
 tests/test/tprec5.pp svneol=native#text/plain
 tests/test/tprec5.pp svneol=native#text/plain

+ 4 - 0
compiler/pdecvar.pas

@@ -1052,6 +1052,10 @@ implementation
           { variable }
           { variable }
           else
           else
             begin
             begin
+              { we have to be able to take the address of the absolute
+                expression
+              }
+              valid_for_addr(pt,true);
               { remove subscriptn before checking for loadn }
               { remove subscriptn before checking for loadn }
               hp:=pt;
               hp:=pt;
               while (hp.nodetype in [subscriptn,typeconvn,vecn]) do
               while (hp.nodetype in [subscriptn,typeconvn,vecn]) do

+ 12 - 0
tests/test/tprec24.pp

@@ -0,0 +1,12 @@
+{ %fail }
+
+type
+  ta = bitpacked record
+    a, b, c, d: 0..15;
+  end;
+var
+  c: ta;
+  d: byte absolute c.a;
+begin
+end.
+