summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-03-09 13:23:44 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-03-09 13:23:44 +0000
commitfe93cfe6a463b380b5b288b71999ecaa8364b9b2 (patch)
tree602734e5c5384bcc6fc202050ea1b94e3e0d3aa6
parentdd367d39b2a5d2fb8a25fec1c7cfc653c7a16b1b (diff)
downloadppe42-gcc-fe93cfe6a463b380b5b288b71999ecaa8364b9b2.tar.gz
ppe42-gcc-fe93cfe6a463b380b5b288b71999ecaa8364b9b2.zip
PR middle-end/5877
* expr.c (highest_pow2_factor): Check TREE_INT_CST_LOW even for non-representable constants. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50495 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/expr.c23
2 files changed, 18 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 559ab4f4fb1..9f329be7ede 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2002-03-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/5877
+ * expr.c (highest_pow2_factor): Check TREE_INT_CST_LOW
+ even for non-representable constants.
+
Sat Mar 9 07:20:01 2002 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* emit-rtl.c (copy_most_rtx): Accept EXPR_LIST for may_share.
diff --git a/gcc/expr.c b/gcc/expr.c
index caf5a75f8ea..ac756432f20 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5827,20 +5827,21 @@ highest_pow2_factor (exp)
switch (TREE_CODE (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, 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
+ /* We can find the lowest bit that's a one. If the low
+ HOST_BITS_PER_WIDE_INT bits are 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))
+ if (TREE_CONSTANT_OVERFLOW (exp))
return BIGGEST_ALIGNMENT;
- else if (host_integerp (exp, 0))
+ else
{
- c0 = tree_low_cst (exp, 0);
- c0 = c0 < 0 ? - c0 : c0;
- return c0 & -c0;
+ /* Note: tree_low_cst is intentionally not used here,
+ we don't care about the upper bits. */
+ c0 = TREE_INT_CST_LOW (exp);
+ c0 &= -c0;
+ return c0 ? c0 : BIGGEST_ALIGNMENT;
}
break;
OpenPOWER on IntegriCloud