From aa65525fff7375e52d0aac6f19cbf8007a84d307 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Wed, 1 Nov 2006 01:03:10 +0000 Subject: [PATCH] * fixed incompatibility between -gt and openstring (and faked open strings like the result of fpc_ansistr_to_shortstr) git-svn-id: trunk@5140 - --- compiler/ncgutil.pas | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index 92a03e3b78..6fb8fa78a4 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -987,8 +987,17 @@ implementation {$endif} LOC_REFERENCE : begin - trash_reference(list,tabstractnormalvarsym(p).initialloc.reference, - tlocalvarsym(p).getsize); + if ((tsym(p).typ=localvarsym) and + not(vo_is_funcret in tabstractvarsym(p).varoptions)) or + not is_shortstring(tabstractnormalvarsym(p).vardef) then + trash_reference(list,tabstractnormalvarsym(p).initialloc.reference, + tlocalvarsym(p).getsize) + else + { may be an open string, even if is_open_string() returns } + { false for some helpers in the system unit } + { an open string has at least size 2 } + trash_reference(list,tabstractnormalvarsym(p).initialloc.reference, + 2); end; LOC_CMMREGISTER : ; @@ -1196,7 +1205,13 @@ implementation tmpreg:=cg.getaddressregister(list); cg.a_load_loc_reg(list,OS_ADDR,tparavarsym(p).initialloc,tmpreg); reference_reset_base(href,tmpreg,0); - trash_reference(list,href,tparavarsym(p).vardef.size); + { may be an open string, even if is_open_string() returns } + { false for some helpers in the system unit } + if not is_shortstring(tparavarsym(p).vardef) then + trash_reference(list,href,tparavarsym(p).vardef.size) + else + { an open string has at least size 2 } + trash_reference(list,href,2); end end; end;