From 1e4737c46da8b8ce881384606a885f4fbb6b112c Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 6 Nov 2013 21:10:50 +0000 Subject: [PATCH] * fix life information of for nodes git-svn-id: trunk@25972 - --- compiler/optdfa.pas | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/compiler/optdfa.pas b/compiler/optdfa.pas index ff03a7c6cb..5deeedc8ff 100644 --- a/compiler/optdfa.pas +++ b/compiler/optdfa.pas @@ -341,10 +341,13 @@ unit optdfa; { create life for the body } CreateInfo(tfornode(node).t2); - { update for node } - { life:=life+body } - l:=copy(node.optinfo^.life); - DFASetIncludeSet(l,tfornode(node).t2.optinfo^.life); + { expect a blocknode as body because we need to push the life information + of the counter variable into it } + if tfornode(node).t2.nodetype<>blockn then + internalerror(2013110201); + + { first update the body } + l:=copy(tfornode(node).t2.optinfo^.life); { take care of the sucessor as it's possible that we don't have one execution of the body } DFASetIncludeSet(l,node.successor.optinfo^.life); @@ -355,6 +358,12 @@ unit optdfa; { force block node life info } UpdateLifeInfo(tfornode(node).t2,l); + { avoid to modify the life information set above for t2 } + l:=copy(l); + + { update l for the for node itself } + DFASetIncludeSet(l,tfornode(node).t2.optinfo^.life); + { the counter variable is not living at the entry of the for node } DFASetExclude(l,tfornode(node).left.optinfo^.index);