* inherit nf_write/nf_modify in tcallnode.replaceparaload also when replacing parameters

git-svn-id: trunk@22075 -
This commit is contained in:
florian 2012-08-13 15:06:16 +00:00
parent ecb037ad79
commit 5b90a02e75
3 changed files with 27 additions and 2 deletions

1
.gitattributes vendored
View File

@ -10258,6 +10258,7 @@ tests/test/opt/tcse1.pp svneol=native#text/plain
tests/test/opt/tcse2.pp svneol=native#text/plain
tests/test/opt/tcse3.pp svneol=native#text/plain
tests/test/opt/tcse4.pp svneol=native#text/pascal
tests/test/opt/tcse5.pp svneol=native#text/pascal
tests/test/opt/tdfa1.pp svneol=native#text/pascal
tests/test/opt/tdfa2.pp svneol=native#text/pascal
tests/test/opt/tgotoreg.pp svneol=native#text/plain

View File

@ -3623,8 +3623,11 @@ implementation
paras := tcallparanode(paras.right);
if assigned(paras) then
begin
temp:=paras.left.getcopy;
{ inherit modification information, this is needed by the dfa/cse }
temp.flags:=temp.flags+(n.flags*[nf_modify,nf_write]);
n.free;
n := paras.left.getcopy;
n:=temp;
typecheckpass(n);
result := fen_true;
end;
@ -3642,7 +3645,7 @@ implementation
{ inherit modification information, this is needed by the dfa/cse }
temp.flags:=temp.flags+(n.flags*[nf_modify,nf_write]);
n.free;
n := temp;
n:=temp;
typecheckpass(n);
result := fen_true;
end;

21
tests/test/opt/tcse5.pp Normal file
View File

@ -0,0 +1,21 @@
{ %OPT=-Ooautoinline -Oocse }
{$mode objfpc}
type
trec = record
b : byte;
end;
procedure p(var b : byte);
begin
b:=b*2;
end;
var
rec : trec;
begin
rec.b:=12;
p(rec.b);
if rec.b<>24 then
halt(1);
writeln('ok');
end.