expr.c (highest_pow2_factor, [...]): Return BIGGEST_ALIGNMENT for 0.
authorRichard Kenner <kenner@gcc.gnu.org>
Sat, 15 Dec 2001 13:37:16 +0000 (08:37 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Sat, 15 Dec 2001 13:37:16 +0000 (08:37 -0500)
* expr.c (highest_pow2_factor, case INTEGER_CST): Return
BIGGEST_ALIGNMENT for 0.

From-SVN: r48042

gcc/ChangeLog
gcc/expr.c

index b4214f969ff82899c10f2c175bd22368cbf8eb54..114d6045f0c06244add08701de68c2b28f59fb04 100644 (file)
@@ -1,7 +1,13 @@
+Sat Dec 15 08:29:45 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * expr.c (highest_pow2_factor, case INTEGER_CST): Return
+       BIGGEST_ALIGNMENT for 0.
+
 Sat Dec 15 14:13:03 CET 2001  Jan Hubicka  <jh@suse.cz>
 
-       * predict.def (PRED_NORETURN, PRED_OPCODE_POSITIVE, PRED_OPCODE_NONEQUAL,
-       PRED_ERROR_RETURN): Make probabilities match reality.
+       * predict.def (PRED_NORETURN): Make probabilities match reality.
+       (PRED_OPCODE_POSITIVE, PRED_OPCODE_NONEQUAL, PRED_ERROR_RETURN):
+       Likewise.
 
 2001-12-15  Jakub Jelinek  <jakub@redhat.com>
 
index 9e5bf955adbece6616450071b6e45cbe13bb72c8..906a04ede0db9a1a0bd82da36d325f2a669b2544 100644 (file)
@@ -5793,18 +5793,18 @@ highest_pow2_factor (exp)
     {
     case INTEGER_CST:
       /* If the integer is expressable in a HOST_WIDE_INT, we can find the
-        lowest bit that's a one.  If the result is zero, pessimize by
-        returning 1.  This is overly-conservative, but such things should not
-        happen in the offset expressions that we are called with.  If
-        the constant overlows, we some erroneous program, so return
-        BIGGEST_ALIGNMENT to avoid any later ICE.  */
-      if (TREE_CONSTANT_OVERFLOW (exp))
+        lowest bit that's a one.  If the result is zero, return
+        BIGGEST_ALIGNMENT.  We need to handle this case since we can find it
+        in a COND_EXPR, a MIN_EXPR, or a MAX_EXPR.  If the constant overlows,
+        we have an erroneous program, so return BIGGEST_ALIGNMENT to avoid any
+        later ICE.  */
+      if (TREE_CONSTANT_OVERFLOW (exp)
+         || integer_zerop (exp))
        return BIGGEST_ALIGNMENT;
       else if (host_integerp (exp, 0))
        {
          c0 = tree_low_cst (exp, 0);
-         c0 = c0 < 0 ? - c0 : c0;
-         return c0 != 0 ? c0 & -c0 : 1;
+         return c0 < 0 ? - c0 : c0;
        }
       break;