* properly detect when we can't take the address of a with-expression

and assign it to a temp in that case (mantis #8141)

git-svn-id: trunk@6071 -
This commit is contained in:
Jonas Maebe 2007-01-19 13:01:07 +00:00
parent 4ed3ef645b
commit 2ad3ef968f
3 changed files with 14 additions and 2 deletions

1
.gitattributes vendored
View File

@ -7964,6 +7964,7 @@ tests/webtbs/tw8028.pp svneol=native#text/plain
tests/webtbs/tw8049.pp svneol=native#text/plain
tests/webtbs/tw8055.pp svneol=native#text/plain
tests/webtbs/tw8090.pp svneol=native#text/plain
tests/webtbs/tw8141.pp svneol=native#text/plain
tests/webtbs/ub1873.pp svneol=native#text/plain
tests/webtbs/ub1883.pp svneol=native#text/plain
tests/webtbs/uw0555.pp svneol=native#text/plain

View File

@ -508,8 +508,9 @@ implementation
calltempnode:=nil;
{ complex load, load in temp first }
newblock:=internalstatements(newstatement);
{ when right is a call then load it first in a temp }
if p.nodetype=calln then
{ when we can't take the address of p, load it in a temp }
{ since we may need its address later on }
if not valid_for_addr(p,false) then
begin
calltempnode:=ctempcreatenode.create(p.resultdef,p.resultdef.size,tt_persistent,true);
addstatement(newstatement,calltempnode);

10
tests/webtbs/tw8141.pp Normal file
View File

@ -0,0 +1,10 @@
{ %norun }
uses
Classes, SysUtils;
var
List : TList;
begin
with LongRec(Pointer(List.Last)) do
lo := 1;
end.