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, 5 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 33e27af..b801f2a 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3836,6 +3836,11 @@ make_range (tree exp, int *pin_p, tree *plow, tree *phigh)
if (TREE_CODE (arg1) != INTEGER_CST)
break;
+ /* If flag_wrapv and ARG0_TYPE is signed, then we cannot
+ move a constant to the other side. */
+ if (flag_wrapv && !TYPE_UNSIGNED (arg0_type))
+ break;
+
/* If EXP is signed, any overflow in the computation is undefined,
so we don't worry about it so long as our computations on
the bounds don't overflow. For unsigned, overflow is defined