From ea69a5b372db2e43190cc502392b965f76290de1 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 18 Nov 2018 11:07:28 +0000 Subject: [PATCH] * finalizetemps nodes should never be considered equal and have side effects git-svn-id: trunk@40348 - --- compiler/nbas.pas | 7 +++++++ compiler/nutils.pas | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/nbas.pas b/compiler/nbas.pas index 5efbe90cf1..846c417369 100644 --- a/compiler/nbas.pas +++ b/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 diff --git a/compiler/nutils.pas b/compiler/nutils.pas index ba8cd95b03..8c643259be 100644 --- a/compiler/nutils.pas +++ b/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,