From: Bernd Schmidt Date: Thu, 30 Nov 2000 11:53:40 +0000 (+0000) Subject: Backport a change to the 2.95 branch X-Git-Tag: prereleases/gcc-2.95.3-test1~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62610d6f57cb2e799f56ec2ea5876ba540b84805;p=thirdparty%2Fgcc.git Backport a change to the 2.95 branch From-SVN: r37876 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8cfa93c8921a..790e3575d1c3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2000-11-30 Bernd Schmidt + Sat May 20 07:27:35 2000 Alexandre Oliva + * fold-const.c (make_range): Handle degenerated intervals. + Fixes c-torture/execute/991221-1.c + 2000-07-15 Michael Meissner * fold-const.c (fold): When optimizing FOO++ == CONST into ++FOO == CONST + INCREMENT, don't overwrite the tree node for FOO++, diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 2d4f907aa8cd..f260ab4b5004 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3259,8 +3259,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;