From 78bb3e323a10074de47ce0023b57e173601dd3ab Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 20 May 2012 20:34:14 +0000 Subject: [PATCH] * fixed source type information for values loaded in arrayconstructor after r21069 git-svn-id: trunk@21350 - --- .gitattributes | 1 + compiler/ncgld.pas | 2 +- tests/tbs/tb0581.pp | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tests/tbs/tb0581.pp diff --git a/.gitattributes b/.gitattributes index b7d99c2b80..f8fd275e6e 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/ncgld.pas b/compiler/ncgld.pas index 86d04569be..cc9f342745 100644 --- a/compiler/ncgld.pas +++ b/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); diff --git a/tests/tbs/tb0581.pp b/tests/tbs/tb0581.pp new file mode 100644 index 0000000000..a5214f5a03 --- /dev/null +++ b/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.