diff --git a/.gitattributes b/.gitattributes index 67493d0ead..6bf8a1c5fb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18408,6 +18408,7 @@ tests/webtbs/tw3742.pp svneol=native#text/plain tests/webtbs/tw37427.pp svneol=native#text/pascal tests/webtbs/tw37449.pp svneol=native#text/pascal tests/webtbs/tw37468.pp svneol=native#text/pascal +tests/webtbs/tw37477.pp svneol=native#text/pascal tests/webtbs/tw37493.pp svneol=native#text/pascal tests/webtbs/tw3751.pp svneol=native#text/plain tests/webtbs/tw3758.pp svneol=native#text/plain diff --git a/compiler/optcse.pas b/compiler/optcse.pas index 8e5821413d..5337339171 100644 --- a/compiler/optcse.pas +++ b/compiler/optcse.pas @@ -307,7 +307,10 @@ unit optcse; begin result:=fen_false; nodes:=nil; - if n.nodetype in cseinvariant then + if (n.nodetype in cseinvariant) and + { a setelement node is cseinvariant, but it might not be replaced by a block so + it cannot be the root of the cse search } + (n.nodetype<>setelementn) then begin csedomain:=true; foreachnodestatic(pm_postprocess,n,@searchsubdomain,@csedomain); diff --git a/tests/webtbs/tw37477.pp b/tests/webtbs/tw37477.pp new file mode 100644 index 0000000000..714d91395c --- /dev/null +++ b/tests/webtbs/tw37477.pp @@ -0,0 +1,6 @@ +{ %OPT=-O3 } +{ %norun } +var a : integer; +begin + write(a = a in[a in[a], a / 0 > a]) +end.