Browse Source

* fixed source type information for values loaded in arrayconstructor after
r21069

git-svn-id: trunk@21350 -

Jonas Maebe 13 years ago
parent
commit
78bb3e323a
3 changed files with 27 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/ncgld.pas
  3. 25 0
      tests/tbs/tb0581.pp

+ 1 - 0
.gitattributes

@@ -9571,6 +9571,7 @@ tests/tbs/tb0577a.pp svneol=native#text/plain
 tests/tbs/tb0578.pp svneol=native#text/pascal
 tests/tbs/tb0579.pp svneol=native#text/pascal
 tests/tbs/tb0580.pp svneol=native#text/pascal
+tests/tbs/tb0581.pp svneol=native#text/plain
 tests/tbs/tb205.pp svneol=native#text/plain
 tests/tbs/ub0060.pp svneol=native#text/plain
 tests/tbs/ub0069.pp svneol=native#text/plain

+ 1 - 1
compiler/ncgld.pas

@@ -1239,7 +1239,7 @@ implementation
                   end
                  else
                   { todo: proper type information for hlcg }
-                  hlcg.a_load_loc_ref(current_asmdata.CurrAsmList,voidpointertype,voidpointertype,hp.left.location,href);
+                  hlcg.a_load_loc_ref(current_asmdata.CurrAsmList,hp.left.resultdef,voidpointertype,hp.left.location,href);
                  { update href to the vtype field and write it }
                  dec(href.offset,sizeof(pint));
                  cg.a_load_const_ref(current_asmdata.CurrAsmList, OS_INT,vtype,href);

+ 25 - 0
tests/tbs/tb0581.pp

@@ -0,0 +1,25 @@
+{$mode objfpc}
+
+
+procedure dirtystack;
+var
+  s: shortstring;
+begin
+  fillchar(s,sizeof(s),255);
+end;
+
+procedure test(const arr: array of const);
+begin
+  if arr[0].vinteger<>ord('$') then
+    halt(1);
+end;
+
+procedure doit;
+begin
+  test(['$']);
+end;
+
+begin
+  dirtystack;
+  doit;
+end.