Browse Source

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

git-svn-id: trunk@40348 -
Jonas Maebe 6 years ago
parent
commit
ea69a5b372
2 changed files with 8 additions and 1 deletions
  1. 7 0
      compiler/nbas.pas
  2. 1 1
      compiler/nutils.pas

+ 7 - 0
compiler/nbas.pas

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

+ 1 - 1
compiler/nutils.pas

@@ -1342,7 +1342,7 @@ implementation
     function check_for_sideeffect(var n: tnode; arg: pointer): foreachnoderesult;
       begin
         result:=fen_false;
-        if (n.nodetype in [assignn,calln,asmn]) or
+        if (n.nodetype in [assignn,calln,asmn,finalizetempsn]) or
           ((n.nodetype=inlinen) and
            (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,