Browse Source

* set nf_* correctly when an inc/dec node is converted into an add/sub node
* do not firstpass during dead store removal as it disturbes the for each calls

git-svn-id: trunk@44180 -

florian 5 years ago
parent
commit
3947922fea
2 changed files with 6 additions and 2 deletions
  1. 3 0
      compiler/ninl.pas
  2. 3 2
      compiler/optdeadstore.pas

+ 3 - 0
compiler/ninl.pas

@@ -4367,6 +4367,9 @@ implementation
            end;
            end;
 
 
          resultnode := hp.getcopy;
          resultnode := hp.getcopy;
+         { get varstates right }
+         node_reset_flags(resultnode,[nf_pass1_done,nf_modify]);
+
          { avoid type errors from the addn/subn }
          { avoid type errors from the addn/subn }
          if not is_integer(resultnode.resultdef) then
          if not is_integer(resultnode.resultdef) then
            begin
            begin

+ 3 - 2
compiler/optdeadstore.pas

@@ -94,8 +94,9 @@ unit optdeadstore;
                         tstatementnode(n).statement.free;
                         tstatementnode(n).statement.free;
 
 
                         tstatementnode(n).statement:=cnothingnode.create;
                         tstatementnode(n).statement:=cnothingnode.create;
-                        Exclude(tstatementnode(n).flags, nf_pass1_done);
-                        do_firstpass(n);
+                        { do not run firstpass on n here, as it will remove the statement node
+                          and this will make foreachnodestatic process the wrong nodes as the current statement
+                          node will disappear }
                       end
                       end
                   end;
                   end;
               end;
               end;