From 3947922fea2604edcb2a4af366332cea338c5907 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 15 Feb 2020 13:53:16 +0000 Subject: [PATCH] * 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 - --- compiler/ninl.pas | 3 +++ compiler/optdeadstore.pas | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/ninl.pas b/compiler/ninl.pas index 5418306717..066b66edf8 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -4367,6 +4367,9 @@ implementation end; resultnode := hp.getcopy; + { get varstates right } + node_reset_flags(resultnode,[nf_pass1_done,nf_modify]); + { avoid type errors from the addn/subn } if not is_integer(resultnode.resultdef) then begin diff --git a/compiler/optdeadstore.pas b/compiler/optdeadstore.pas index 7fd259d995..7cd7d8ca25 100644 --- a/compiler/optdeadstore.pas +++ b/compiler/optdeadstore.pas @@ -94,8 +94,9 @@ unit optdeadstore; tstatementnode(n).statement.free; 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;