Browse Source

* revert for loops also if the upper limit is non-constant

florian 8 months ago
parent
commit
c236ac5e97
1 changed files with 5 additions and 2 deletions
  1. 5 2
      compiler/optloop.pas

+ 5 - 2
compiler/optloop.pas

@@ -641,8 +641,11 @@ unit optloop;
           not(lnf_backward in tfornode(n).loopflags) and
           not(lnf_backward in tfornode(n).loopflags) and
           (lnf_dont_mind_loopvar_on_exit in tfornode(n).loopflags) and
           (lnf_dont_mind_loopvar_on_exit in tfornode(n).loopflags) and
           is_constintnode(tfornode(n).right) and
           is_constintnode(tfornode(n).right) and
-          { this is not strictly necessary, but we do it for now }
-          is_constnode(tfornode(n).t1) and
+          { this is not strictly necessary, but we do it for now;
+
+            found not case so far where it cause trouble to remove the check, so commented
+
+            is_constnode(tfornode(n).t1) and }
           (([cs_check_overflow,cs_check_range]*n.localswitches)=[]) and
           (([cs_check_overflow,cs_check_range]*n.localswitches)=[]) and
           (([cs_check_overflow,cs_check_range]*tfornode(n).left.localswitches)=[]) and
           (([cs_check_overflow,cs_check_range]*tfornode(n).left.localswitches)=[]) and
           ((tfornode(n).left.nodetype=loadn) and (tloadnode(tfornode(n).left).symtableentry is tabstractvarsym) and
           ((tfornode(n).left.nodetype=loadn) and (tloadnode(tfornode(n).left).symtableentry is tabstractvarsym) and