diff --git a/compiler/optutils.pas b/compiler/optutils.pas index a82286274a..72552c54c1 100644 --- a/compiler/optutils.pas +++ b/compiler/optutils.pas @@ -47,6 +47,9 @@ unit optutils; } procedure CalcDefSum(p : tnode); + { returns true, if n is a valid node and has life info } + function has_life_info(n : tnode) : boolean; + implementation uses @@ -192,6 +195,7 @@ unit optutils; result:=p; { the successor of the last node of the for body is the for node itself } DoSet(tfornode(p).t2,p); + p.successor:=succ; Breakstack.Delete(Breakstack.Count-1); Continuestack.Delete(Continuestack.Count-1); p.successor:=succ; @@ -211,7 +215,7 @@ unit optutils; Breakstack.Add(succ); Continuestack.Add(p); result:=p; - { the successor of the last node of the while body is the while node itself } + { the successor of the last node of the while/repeat body is the while node itself } DoSet(twhilerepeatnode(p).right,p); p.successor:=succ; Breakstack.Delete(Breakstack.Count-1); @@ -324,5 +328,12 @@ unit optutils; end; end; + + function has_life_info(n : tnode) : boolean; + begin + result:=assigned(n) and assigned(n.optinfo) and + assigned(n.optinfo^.life); + end; + end.