aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index a775f2713c1..2feaa4eba46 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -8933,7 +8933,8 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
/* If the constant operation overflowed this can be
simplified as a comparison against INT_MAX/INT_MIN. */
if (TREE_CODE (lhs) == INTEGER_CST
- && TREE_OVERFLOW (lhs))
+ && TREE_OVERFLOW (lhs)
+ && !TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg0)))
{
int const1_sgn = tree_int_cst_sgn (const1);
enum tree_code code2 = code;
@@ -13085,6 +13086,8 @@ fold_binary_loc (location_t loc,
tree arg01 = TREE_OPERAND (arg0, 1);
tree itype = TREE_TYPE (arg00);
if (TREE_INT_CST_HIGH (arg01) == 0
+ && !(TREE_CODE (itype) == COMPLEX_TYPE
+ || TREE_CODE (itype) == VECTOR_TYPE)
&& TREE_INT_CST_LOW (arg01)
== (unsigned HOST_WIDE_INT) (TYPE_PRECISION (itype) - 1))
{