mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 11:18:18 +02:00
* calculate life info for if nodes correctly if the then branch is empty, resolves #39992
This commit is contained in:
parent
c9461b7313
commit
3b43bd027c
@ -449,7 +449,9 @@ unit optdfa;
|
||||
|
||||
{ get life info from then branch }
|
||||
if assigned(tifnode(node).right) then
|
||||
DFASetIncludeSet(l,tifnode(node).right.optinfo^.life);
|
||||
DFASetIncludeSet(l,tifnode(node).right.optinfo^.life)
|
||||
else if assigned(node.successor) then
|
||||
DFASetIncludeSet(l,node.successor.optinfo^.life);
|
||||
|
||||
{ get life info from else branch }
|
||||
if assigned(tifnode(node).t1) then
|
||||
|
19
tests/webtbs/tw39992.pp
Normal file
19
tests/webtbs/tw39992.pp
Normal file
@ -0,0 +1,19 @@
|
||||
{ %OPT=-O3 -Oodeadstore }
|
||||
|
||||
{$mode objfpc}
|
||||
function ChooseMinus10: SizeInt;
|
||||
var
|
||||
chosen: SizeInt;
|
||||
begin
|
||||
chosen := -10;
|
||||
repeat
|
||||
if random(1) = 0 then else break;
|
||||
exit(chosen);
|
||||
until false;
|
||||
result := -20;
|
||||
end;
|
||||
|
||||
begin
|
||||
if ChooseMinus10<>-10 then
|
||||
halt(1);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user