diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-09-14 12:36:36 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-09-14 12:36:36 +0200 |
commit | 645ef01a463f15fc230e2155719c7a12cec89acf (patch) | |
tree | 600f894f2595d530f45314ed9b322dedaa2347b0 /gcc/fortran | |
parent | 05f5c42cb42c5088187d44cc45a5f671d19ad8c5 (diff) | |
download | gcc-645ef01a463f15fc230e2155719c7a12cec89acf.zip gcc-645ef01a463f15fc230e2155719c7a12cec89acf.tar.gz gcc-645ef01a463f15fc230e2155719c7a12cec89acf.tar.bz2 |
Disallow pointer operands for |, ^ and partly & [PR106878]
My change to match.pd (that added the two simplifications this patch
touches) results in more |/^/& assignments with pointer arguments,
but since r12-1608 we reject pointer operands for BIT_NOT_EXPR.
Disallowing them for BIT_NOT_EXPR and allowing for BIT_{IOR,XOR,AND}_EXPR
leads to a match.pd maintainance nightmare (see one of the patches in the
PR), so either we want to allow pointer operand on BIT_NOT_EXPR (but then
we run into issues e.g. with the ranger which expects it can emulate
BIT_NOT_EXPR ~X as - 1 - X which doesn't work for pointers which don't
support MINUS_EXPR), or the following patch disallows pointer arguments
for all of BIT_{IOR,XOR,AND}_EXPR with the exception of BIT_AND_EXPR
with INTEGER_CST last operand (for simpler pointer realignment).
I had to tweak one reassoc optimization and the two match.pd
simplifications.
2022-09-14 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/106878
* tree-cfg.cc (verify_gimple_assign_binary): Disallow pointer,
reference or OFFSET_TYPE BIT_IOR_EXPR, BIT_XOR_EXPR or, unless
the second argument is INTEGER_CST, BIT_AND_EXPR.
* match.pd ((type) X op CST -> (type) (X op ((type-x) CST)),
(type) (((type2) X) op Y) -> (X op (type) Y)): Punt for
POINTER_TYPE_P or OFFSET_TYPE.
* tree-ssa-reassoc.cc (optimize_range_tests_cmp_bitwise): For
pointers cast them to pointer sized integers first.
* gcc.c-torture/compile/pr106878.c: New test.
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions