summaryrefslogtreecommitdiffstats
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-30 12:36:18 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-30 12:36:18 +0000
commit51f5794ef7b5dae3138387a40ea52fba975a6251 (patch)
treee7880e3c3edf324e2b6001c06571ddb2f5245a1c /gcc/fold-const.c
parent1513fa8851a2ccebe5dff5699ba7ad430bf0c3ad (diff)
downloadppe42-gcc-51f5794ef7b5dae3138387a40ea52fba975a6251.tar.gz
ppe42-gcc-51f5794ef7b5dae3138387a40ea52fba975a6251.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171723 138bc75d-0d04-0410-961f-82ee72b054a4
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 017aa8ad9cb..0c0420d043c 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
OpenPOWER on IntegriCloud