Sfoglia il codice sorgente

* fixed internalerror in case of dereferencing a loc_(c)subsetreg/ref
(mantis #15812)

git-svn-id: trunk@14925 -

Jonas Maebe 15 anni fa
parent
commit
fe5d0b0ef4
3 ha cambiato i file con 30 aggiunte e 0 eliminazioni
  1. 1 0
      .gitattributes
  2. 2 0
      compiler/ncgmem.pas
  3. 27 0
      tests/webtbs/tw15812.pp

+ 1 - 0
.gitattributes

@@ -10293,6 +10293,7 @@ tests/webtbs/tw15694.pp svneol=native#text/plain
 tests/webtbs/tw15727a.pp svneol=native#text/plain
 tests/webtbs/tw15728.pp svneol=native#text/plain
 tests/webtbs/tw1573.pp svneol=native#text/plain
+tests/webtbs/tw15812.pp svneol=native#text/plain
 tests/webtbs/tw1592.pp svneol=native#text/plain
 tests/webtbs/tw1617.pp svneol=native#text/plain
 tests/webtbs/tw1622.pp svneol=native#text/plain

+ 2 - 0
compiler/ncgmem.pas

@@ -224,6 +224,8 @@ implementation
            location_reset_ref(location,LOC_REFERENCE,def_cgsize(resultdef),resultdef.alignment)
          else
            location_reset_ref(location,LOC_REFERENCE,def_cgsize(resultdef),1);
+         if not(left.location.loc in [LOC_CREGISTER,LOC_REGISTER,LOC_CREFERENCE,LOC_REFERENCE,LOC_CONSTANT]) then
+           location_force_reg(current_asmdata.CurrAsmList,left.location,OS_ADDR,true);
          case left.location.loc of
             LOC_CREGISTER,
             LOC_REGISTER:

+ 27 - 0
tests/webtbs/tw15812.pp

@@ -0,0 +1,27 @@
+{$mode macpas}
+program test;
+
+type
+  Rec1Ptr = ^Rec1;
+  Rec1 =
+    record
+      case boolean of
+        False : ( f1: Integer);
+        True : ( case boolean of
+                    False: ( f2: Integer);
+                    True : ( f3: Integer))
+    end;
+  Rec2 =
+    record
+      case boolean of
+        False : ( p1: Rec1Ptr);
+        True : ( p2: Pointer)
+    end;
+
+procedure PP( theRec2: Rec2; var theRec1: Rec1);
+  begin
+    theRec1 := theRec2.p1^
+  end;
+
+begin
+end.