match.pd: Don't create BIT_NOT_EXPRs for COMPLEX_TYPE [PR104675]
authorJakub Jelinek <jakub@redhat.com>
Fri, 25 Feb 2022 09:55:17 +0000 (10:55 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 25 Feb 2022 09:55:17 +0000 (10:55 +0100)
commit758671b88b78d7629376b118ec6ca6bcfbabbd36
tree477dbcbde4934fee3df44ae570d48d6927c90a20
parenta9e2ebe839d56416ceaff1a40df54de4890539be
match.pd: Don't create BIT_NOT_EXPRs for COMPLEX_TYPE [PR104675]

We don't support BIT_{AND,IOR,XOR,NOT}_EXPR on complex types,
&/|/^ are just rejected for them, and ~ is parsed as CONJ_EXPR.
So, we should avoid simplifications which turn valid complex type
expressions into something that will ICE during expansion.

2022-02-25  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/104675
* match.pd (-A - 1 -> ~A, -1 - A -> ~A): Don't simplify for
COMPLEX_TYPE.

* gcc.dg/pr104675-1.c: New test.
* gcc.dg/pr104675-2.c: New test.
gcc/match.pd
gcc/testsuite/gcc.dg/pr104675-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr104675-2.c [new file with mode: 0644]