http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51730
--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-02 14:15:39 UTC --- Like Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c (revision 182784) +++ gcc/fold-const.c (working copy) @@ -8886,6 +8886,13 @@ fold_comparison (location_t loc, enum tr indirect_base0 = true; } offset0 = TREE_OPERAND (arg0, 1); + if (host_integerp (offset0, 1) + && (TREE_INT_CST_LOW (offset0) + & ((unsigned HOST_WIDE_INT)-1 << (HOST_BITS_PER_WIDE_INT - exact_log2 (BITS_PER_UNIT)))) == 0) + { + bitpos0 = TREE_INT_CST_LOW (offset0) * BITS_PER_UNIT; + offset0 = NULL_TREE; + } } base1 = arg1; @@ -8909,6 +8916,13 @@ fold_comparison (location_t loc, enum tr indirect_base1 = true; } offset1 = TREE_OPERAND (arg1, 1); + if (host_integerp (offset1, 1) + && (TREE_INT_CST_LOW (offset1) + & ((unsigned HOST_WIDE_INT)-1 << (HOST_BITS_PER_WIDE_INT - exact_log2 (BITS_PER_UNIT)))) == 0) + { + bitpos1 = TREE_INT_CST_LOW (offset1) * BITS_PER_UNIT; + offset1 = NULL_TREE; + } } /* A local variable can never be pointed to by to be beautified ...