middle-end/108625 - wrong folding due to misinterpreted !
authorRichard Biener <rguenther@suse.de>
Thu, 2 Feb 2023 10:09:26 +0000 (11:09 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 2 Feb 2023 12:13:26 +0000 (13:13 +0100)
commit605d1297b91c2c7c23ccfe669e66dda5791d1f55
treee8b9b903d6e8c9e757e594e7d439499b81c44023
parentf6fff8a6fcd8375aa1056671fcd8de76304e8973
middle-end/108625 - wrong folding due to misinterpreted !

The following fixes a problem with ! handling in genmatch which isn't
conservative enough when intermediate simplifications push to the
sequence but the final operation appears to just pick an existing
(but in this case newly defined in the sequence) operand.  The easiest
fix is to disallow adding to the sequence when processing !.

PR middle-end/108625
* genmatch.cc (expr::gen_transform): Also disallow resimplification
from pushing to lseq with force_leaf.
(dt_simplify::gen_1): Likewise.

* gcc.dg/pr108625.c: New testcase.
gcc/genmatch.cc
gcc/testsuite/gcc.dg/pr108625.c [new file with mode: 0644]