aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-03-30 14:36:18 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2011-03-30 14:36:18 +0200
commit8a87e7abcb28cc53fb1be10b453d030a039de15e (patch)
treee7880e3c3edf324e2b6001c06571ddb2f5245a1c /gcc/fold-const.c
parent12486e033e1e90f999a8d88fa5756828c22db662 (diff)
downloadgcc-8a87e7abcb28cc53fb1be10b453d030a039de15e.zip
gcc-8a87e7abcb28cc53fb1be10b453d030a039de15e.tar.gz
gcc-8a87e7abcb28cc53fb1be10b453d030a039de15e.tar.bz2
re PR c/48305 (ice at -O0: verify_gimple failed)
PR c/48305 * fold-const.c (fold_binary_loc) <case EQ_EXPR, NE_EXPR>: Make sure arg10/arg11 in (X ^ Y) == (Z ^ W) are always fold converted to matching arg00/arg01 types. * gcc.c-torture/compile/pr48305.c: New test. From-SVN: r171723
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 017aa8a..0c0420d 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -12606,13 +12606,21 @@ fold_binary_loc (location_t loc,
operand_equal_p guarantees no side-effects so we don't need
to use omit_one_operand on Z. */
if (operand_equal_p (arg01, arg11, 0))
- return fold_build2_loc (loc, code, type, arg00, arg10);
+ return fold_build2_loc (loc, code, type, arg00,
+ fold_convert_loc (loc, TREE_TYPE (arg00),
+ arg10));
if (operand_equal_p (arg01, arg10, 0))
- return fold_build2_loc (loc, code, type, arg00, arg11);
+ return fold_build2_loc (loc, code, type, arg00,
+ fold_convert_loc (loc, TREE_TYPE (arg00),
+ arg11));
if (operand_equal_p (arg00, arg11, 0))
- return fold_build2_loc (loc, code, type, arg01, arg10);
+ return fold_build2_loc (loc, code, type, arg01,
+ fold_convert_loc (loc, TREE_TYPE (arg01),
+ arg10));
if (operand_equal_p (arg00, arg10, 0))
- return fold_build2_loc (loc, code, type, arg01, arg11);
+ return fold_build2_loc (loc, code, type, arg01,
+ fold_convert_loc (loc, TREE_TYPE (arg01),
+ arg11));
/* Optimize (X ^ C1) op (Y ^ C2) as (X ^ (C1 ^ C2)) op Y. */
if (TREE_CODE (arg01) == INTEGER_CST