From 56d64b007f7eee75266dca41fc570e9286ee6e61 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 26 Jan 2020 20:13:18 +0000 Subject: [PATCH] + in some language modes the loop counter is undefined after the loop by language definition git-svn-id: trunk@44043 - --- compiler/pstatmnt.pas | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas index e62d164f74..ed9a3c9005 100644 --- a/compiler/pstatmnt.pas +++ b/compiler/pstatmnt.pas @@ -507,6 +507,13 @@ implementation exclude(loopvarsym.varoptions,vo_is_loop_counter); result:=cfornode.create(hloopvar,hfrom,hto,hblock,backward); + + { only in tp and mac pascal mode, we care about the value of the loop counter on loop exit + + I am not sure though, if this is the right rule, at least in delphi the loop counter is undefined + on loop exit, we assume the same in all FPC modes } + if ([m_objfpc,m_fpc,m_delphi]*current_settings.modeswitches)<>[] then + Include(tfornode(Result).loopflags,lnf_dont_mind_loopvar_on_exit); end;