Explorar o código

* fixed copy/paste error in the test, and the compiler bug that was
triggered by it (make sure that records with indexed array fields
are never kept in registers), mantis #17283

git-svn-id: trunk@15921 -

Jonas Maebe %!s(int64=15) %!d(string=hai) anos
pai
achega
7ba5eaf272
Modificáronse 2 ficheiros con 15 adicións e 4 borrados
  1. 10 0
      compiler/nmem.pas
  2. 5 4
      tests/webtbs/tw17283.pp

+ 10 - 0
compiler/nmem.pas

@@ -796,6 +796,16 @@ implementation
                inserttypeconv(right,sinttype);
            end;
 
+         { although we never put regular arrays or shortstrings in registers,
+           it's possible that another type was typecasted to a small record
+           that has a field of one of these types -> in that case the record
+           can't be a regvar either }
+         if ((left.resultdef.typ=arraydef) and
+             not is_special_array(left.resultdef)) or
+            ((left.resultdef.typ=stringdef) and
+             (tstringdef(left.resultdef).stringtype in [st_shortstring,st_longstring])) then
+           make_not_regable(left,[ra_addr_regable]);
+
          case left.resultdef.typ of
            arraydef :
              begin

+ 5 - 4
tests/webtbs/tw17283.pp

@@ -8,7 +8,7 @@
       1: (words: array [0..1] of word);
       2: (low,high: word);
       end;
-
+(*
   procedure f_ref(var l,h:word);
   begin
     l:=1;
@@ -35,7 +35,7 @@
     f_ref(tr_32(q).words[0],tr_32(q).words[1]);
     result:=q;
     end;
-
+*)
   function f_test4:longint;
   var
     q: longint;
@@ -50,6 +50,7 @@
     l,q: longint;
     
   begin
+(*
     l:=f_test1;
     if (tr_32(l).low<>1) or
        (tr_32(l).high<>2) then
@@ -76,8 +77,8 @@
     if (tr_32(l).low<>1) or
        (tr_32(l).high<>2) then
       halt(5);
-
-    l:=f_test3;
+*)
+    l:=f_test4;
     if (tr_32(l).low<>1) or
        (tr_32(l).high<>2) then
       halt(6);