aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 55c7f7f..fe67230 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -9538,8 +9538,10 @@ simplify_internal_call_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
}
else
{
- tree r1 = int_const_binop (subcode, vr0.min, vr1.min);
- tree r2 = int_const_binop (subcode, vr0.max, vr1.max);
+ tree r1 = int_const_binop (subcode, vr0.min,
+ subcode == MINUS_EXPR ? vr1.max : vr1.min);
+ tree r2 = int_const_binop (subcode, vr0.max,
+ subcode == MINUS_EXPR ? vr1.min : vr1.max);
if (r1 == NULL_TREE || TREE_OVERFLOW (r1)
|| r2 == NULL_TREE || TREE_OVERFLOW (r2))
return false;