Browse Source

* boolean or/and nodes might be swapped when they have no side effect, in case
of short boolean evaluation, firstcomplex is not called so this does not
hurt short boolean evaluation

git-svn-id: trunk@45403 -

florian 5 years ago
parent
commit
fcf2cd2bea
1 changed files with 2 additions and 1 deletions
  1. 2 1
      compiler/ncgutil.pas

+ 2 - 1
compiler/ncgutil.pas

@@ -191,7 +191,8 @@ implementation
       begin
       begin
          { always calculate boolean AND and OR from left to right }
          { always calculate boolean AND and OR from left to right }
          if (p.nodetype in [orn,andn]) and
          if (p.nodetype in [orn,andn]) and
-            is_boolean(p.left.resultdef) then
+            is_boolean(p.left.resultdef) and
+            (might_have_sideeffects(p.left) or might_have_sideeffects(p.right)) then
            begin
            begin
              if nf_swapped in p.flags then
              if nf_swapped in p.flags then
                internalerror(200709253);
                internalerror(200709253);