fold-const.c (make_range): Handle degenerated intervals.
authorAlexandre Oliva <aoliva@cygnus.com>
Sat, 20 May 2000 10:28:17 +0000 (10:28 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Sat, 20 May 2000 10:28:17 +0000 (10:28 +0000)
* fold-const.c (make_range): Handle degenerated intervals.
Fixes c-torture/execute/991221-1.c

From-SVN: r34045

gcc/ChangeLog
gcc/fold-const.c

index 2d140d8713b92b9b6b4b393dba5afc5d03e61872..72709d2b851fdcc8039be27ab742e32338cdd8ac 100644 (file)
@@ -1,3 +1,8 @@
+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
+
 Fri May 19 18:16:31 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * cse.c (cse_basic_block): Only call find_reg_note if REG_NOTES not 0.
index 93c5816d9a7fd363831b9c85a131e4d568b9a81a..12a8d1a7a4064d8286a95626ae0164b63eeceff1 100644 (file)
@@ -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;