2
0
Эх сурвалжийг харах

* finalizetemps nodes should never be considered equal and have side effects

git-svn-id: trunk@40348 -
Jonas Maebe 6 жил өмнө
parent
commit
ea69a5b372

+ 7 - 0
compiler/nbas.pas

@@ -63,6 +63,7 @@ interface
           constructor create;virtual;
           constructor create;virtual;
           function pass_1 : tnode;override;
           function pass_1 : tnode;override;
           function pass_typecheck:tnode;override;
           function pass_typecheck:tnode;override;
+          function docompare(p: tnode): boolean; override;
        end;
        end;
        tfinalizetempsnodeclass = class of tfinalizetempsnode;
        tfinalizetempsnodeclass = class of tfinalizetempsnode;
 
 
@@ -484,6 +485,12 @@ implementation
         result:=nil;
         result:=nil;
       end;
       end;
 
 
+    function tfinalizetempsnode.docompare(p: tnode): boolean;
+      begin
+        { these nodes should never be coalesced }
+        result:=false;
+      end;
+
 
 
 {*****************************************************************************
 {*****************************************************************************
                             TSTATEMENTNODE
                             TSTATEMENTNODE

+ 1 - 1
compiler/nutils.pas

@@ -1342,7 +1342,7 @@ implementation
     function check_for_sideeffect(var n: tnode; arg: pointer): foreachnoderesult;
     function check_for_sideeffect(var n: tnode; arg: pointer): foreachnoderesult;
       begin
       begin
         result:=fen_false;
         result:=fen_false;
-        if (n.nodetype in [assignn,calln,asmn]) or
+        if (n.nodetype in [assignn,calln,asmn,finalizetempsn]) or
           ((n.nodetype=inlinen) and
           ((n.nodetype=inlinen) and
            (tinlinenode(n).inlinenumber in [in_write_x,in_writeln_x,in_read_x,in_readln_x,in_str_x_string,
            (tinlinenode(n).inlinenumber in [in_write_x,in_writeln_x,in_read_x,in_readln_x,in_str_x_string,
              in_val_x,in_reset_x,in_rewrite_x,in_reset_typedfile,in_rewrite_typedfile,
              in_val_x,in_reset_x,in_rewrite_x,in_reset_typedfile,in_rewrite_typedfile,