<div dir="auto"><div><div class="gmail_quote"><div dir="ltr">Martok <<a href="mailto:listbox@martoks-place.de">listbox@martoks-place.de</a>> schrieb am Fr., 18. Mai 2018, 15:40:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> Citation: "If the loop was terminated prematurely with an exception or a <br>
> break statement, the loop variable retains the value it had when the <br>
> loop was exited."<br>
As a quick fix, not unrolling loops left with exit at least fixes this specific<br>
situation. This still leaves exceptions raised, but IIRC the handlers don't<br>
restore context anyways, we might be okay?<br>
<br>
diff --git a/compiler/optloop.pas b/compiler/optloop.pas<br>
index 46039ffc5a..dc714ea2cc 100644<br>
--- a/compiler/optloop.pas<br>
+++ b/compiler/optloop.pas<br>
@@ -76,7 +76,7 @@ unit optloop;<br>
<br>
function checkbreakcontinue(var n:tnode; arg: pointer): foreachnoderesult;<br>
begin<br>
- if n.nodetype in [breakn,continuen] then<br>
+ if n.nodetype in [breakn,continuen,exitn] then<br>
result:=fen_norecurse_true<br>
else<br>
result:=fen_false;<br>
<br>
I'll be running this on today's snapshot, see if anything else remains.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div></div><div dir="auto">Maybe it should also check for goto and at least explicit raise statements? </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>