]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport a change to the 2.95 branch
authorBernd Schmidt <bernds@redhat.co.uk>
Thu, 30 Nov 2000 11:53:40 +0000 (11:53 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Thu, 30 Nov 2000 11:53:40 +0000 (11:53 +0000)
From-SVN: r37876

gcc/ChangeLog
gcc/fold-const.c

index 8cfa93c8921a21b092dc480e7de3960386fcbce2..790e3575d1c3da43e89b9d04d1e5427a0223a838 100644 (file)
@@ -1,5 +1,9 @@
 2000-11-30  Bernd Schmidt  <bernds@redhat.co.uk>
 
+       Sat May 20 07:27:35 2000  Alexandre Oliva  <aoliva@cygnus.com>
+       * fold-const.c (make_range): Handle degenerated intervals.
+       Fixes c-torture/execute/991221-1.c
+
        2000-07-15  Michael Meissner  <meissner@redhat.com>
        * fold-const.c (fold): When optimizing FOO++ == CONST into ++FOO
        == CONST + INCREMENT, don't overwrite the tree node for FOO++,
index 2d4f907aa8cda3ebceb290e90852cac229bb157c..f260ab4b50046401b541611b3735bed42f9109bc 100644 (file)
@@ -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;