aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>2001-12-15 08:37:16 -0500
committerRichard Kenner <kenner@gcc.gnu.org>2001-12-15 08:37:16 -0500
commit3a531a8b4e988c611b5412ff30bbb7ab26c4b02c (patch)
treefe52f5ec527c1e29bd8a2fc57a4f5229e2eaf2ab /gcc/expr.c
parentdcfcd4365856e8cbec94fafb5766caa899d6a041 (diff)
downloadgcc-3a531a8b4e988c611b5412ff30bbb7ab26c4b02c.zip
gcc-3a531a8b4e988c611b5412ff30bbb7ab26c4b02c.tar.gz
gcc-3a531a8b4e988c611b5412ff30bbb7ab26c4b02c.tar.bz2
expr.c (highest_pow2_factor, [...]): Return BIGGEST_ALIGNMENT for 0.
* expr.c (highest_pow2_factor, case INTEGER_CST): Return BIGGEST_ALIGNMENT for 0. From-SVN: r48042
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 9e5bf95..906a04e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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;