ソースを参照

* don't take size of open array defs, resolves #8615

git-svn-id: trunk@7059 -
florian 18 年 前
コミット
52db191745
3 ファイル変更35 行追加1 行削除
  1. 1 0
      .gitattributes
  2. 5 1
      compiler/pdecvar.pas
  3. 29 0
      tests/webtbs/tw8615.pp

+ 1 - 0
.gitattributes

@@ -8140,6 +8140,7 @@ tests/webtbs/tw8462.pp svneol=native#text/plain
 tests/webtbs/tw8513.pp svneol=native#text/plain
 tests/webtbs/tw8525.pp svneol=native#text/plain
 tests/webtbs/tw8573.pp svneol=native#text/plain
+tests/webtbs/tw8615.pp -text
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 5 - 1
compiler/pdecvar.pas

@@ -814,13 +814,17 @@ implementation
                   abssym.fileinfo:=vs.fileinfo;
                   abssym.abstyp:=tovar;
                   abssym.ref:=node_to_propaccesslist(pt);
+
                   { if the sizes are different, can't be a regvar since you }
                   { can't be "absolute upper 8 bits of a register" (except  }
                   { if its a record field of the same size of a record      }
                   { regvar, but in that case pt.resultdef.size will have    }
                   { the same size since it refers to the field and not to   }
                   { the whole record -- which is why we use pt and not hp)  }
-                  if (vs.vardef.size <> pt.resultdef.size) then
+
+                  { we can't take the size of an open array }
+                  if is_open_array(pt.resultdef) or
+                     (vs.vardef.size <> pt.resultdef.size) then
                     make_not_regable(pt,vr_addr);
                 end
               else

+ 29 - 0
tests/webtbs/tw8615.pp

@@ -0,0 +1,29 @@
+program test;
+
+{$mode objfpc}
+
+function CreateVarArray( const DimCount: integer;
+                         const Bounds: array of integer;
+                         const VarType: integer ): Variant;
+var
+  Dim01: array [0.. 1] of integer absolute Bounds;
+  Dim02: array [0.. 3] of integer absolute Bounds;
+  Dim03: array [0.. 5] of integer absolute Bounds;
+  Dim04: array [0.. 7] of integer absolute Bounds;
+  Dim05: array [0.. 9] of integer absolute Bounds;
+  Dim06: array [0..11] of integer absolute Bounds;
+  Dim07: array [0..13] of integer absolute Bounds;
+  Dim08: array [0..15] of integer absolute Bounds;
+  Dim09: array [0..17] of integer absolute Bounds;
+  Dim10: array [0..19] of integer absolute Bounds;
+  Dim11: array [0..21] of integer absolute Bounds;
+  Dim12: array [0..23] of integer absolute Bounds;
+  Dim13: array [0..25] of integer absolute Bounds;
+  Dim14: array [0..27] of integer absolute Bounds;
+  Dim15: array [0..29] of integer absolute Bounds;
+  Dim16: array [0..31] of integer absolute Bounds;
+begin
+end;
+
+begin
+end.