X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Ffold-const.c;h=40a0986dda87943d93ac81a2dff9f4e09977164e;hp=b88b5d7262130121da3b44e8bea022e8c11d84e0;hb=a6c23958b0f999e3d48b0679e263be234368dc99;hpb=f48068845f391e30be9c0962ab50f70d8c7a4f4d diff --git a/gcc/fold-const.c b/gcc/fold-const.c index b88b5d72621..40a0986dda8 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8886,13 +8886,16 @@ fold_comparison (location_t loc, enum tree_code code, tree type, indirect_base0 = true; } offset0 = TREE_OPERAND (arg0, 1); - if (host_integerp (offset0, 0) - && ((HOST_WIDE_INT) (TREE_INT_CST_LOW (offset0) * BITS_PER_UNIT) - / BITS_PER_UNIT - == (HOST_WIDE_INT) TREE_INT_CST_LOW (offset0))) + if (host_integerp (offset0, 0)) { - bitpos0 = TREE_INT_CST_LOW (offset0) * BITS_PER_UNIT; - offset0 = NULL_TREE; + HOST_WIDE_INT off = size_low_cst (offset0); + if ((HOST_WIDE_INT) (((unsigned HOST_WIDE_INT) off) + * BITS_PER_UNIT) + / BITS_PER_UNIT == (HOST_WIDE_INT) off) + { + bitpos0 = off * BITS_PER_UNIT; + offset0 = NULL_TREE; + } } } @@ -8917,13 +8920,16 @@ fold_comparison (location_t loc, enum tree_code code, tree type, indirect_base1 = true; } offset1 = TREE_OPERAND (arg1, 1); - if (host_integerp (offset1, 0) - && ((HOST_WIDE_INT) (TREE_INT_CST_LOW (offset1) * BITS_PER_UNIT) - / BITS_PER_UNIT - == (HOST_WIDE_INT) TREE_INT_CST_LOW (offset1))) + if (host_integerp (offset1, 0)) { - bitpos1 = TREE_INT_CST_LOW (offset1) * BITS_PER_UNIT; - offset1 = NULL_TREE; + HOST_WIDE_INT off = size_low_cst (offset1); + if ((HOST_WIDE_INT) (((unsigned HOST_WIDE_INT) off) + * BITS_PER_UNIT) + / BITS_PER_UNIT == (HOST_WIDE_INT) off) + { + bitpos1 = off * BITS_PER_UNIT; + offset1 = NULL_TREE; + } } }