mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 20:49:49 +02:00
* inherit nf_write/nf_modify in tcallnode.replaceparaload also when replacing parameters
git-svn-id: trunk@22075 -
This commit is contained in:
parent
ecb037ad79
commit
5b90a02e75
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
21
tests/test/opt/tcse5.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user