summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-20 10:28:17 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-20 10:28:17 +0000
commita80d786b599dde14ee37c84c98f44aec318c143d (patch)
tree213b9a374f52b0b63a22f2294f698269152ff75d /gcc/fold-const.c
parent8928c46876e1b0d2ce0d349cf57e75057e1aff98 (diff)
downloadgcc-a80d786b599dde14ee37c84c98f44aec318c143d.tar.gz
* fold-const.c (make_range): Handle degenerated intervals.
Fixes c-torture/execute/991221-1.c git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34045 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 93c5816d9a7..12a8d1a7a40 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3455,8 +3455,17 @@ make_range (exp, pin_p, plow, phigh)
low = range_binop (PLUS_EXPR, type, n_high, 0,
integer_one_node, 0);
high = range_binop (MINUS_EXPR, type, n_low, 0,
- integer_one_node, 0);
- in_p = ! in_p;
+ integer_one_node, 0);
+
+ /* If the range is of the form +/- [ x+1, x ], we won't
+ be able to normalize it. But then, it represents the
+ whole range or the empty set, so make it
+ +/- [ -, - ]. */
+ if (tree_int_cst_equal (n_low, low)
+ && tree_int_cst_equal (n_high, high))
+ low = high = 0;
+ else
+ in_p = ! in_p;
}
else
low = n_low, high = n_high;