fold-const.c (fold_comparison): Fold &a < &a + 4 even with -fno-strict-overflow.
authorRichard Guenther <rguenther@suse.de>
Wed, 24 Aug 2011 12:51:45 +0000 (12:51 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 24 Aug 2011 12:51:45 +0000 (12:51 +0000)
2011-08-24  Richard Guenther  <rguenther@suse.de>

* fold-const.c (fold_comparison): Fold &a < &a + 4 even
with -fno-strict-overflow.

From-SVN: r178036

gcc/ChangeLog
gcc/fold-const.c

index 7e1db3d1203f62be253808d94a595c1e797b45f4..2c4aadbe186f1b540771f3009e6bd86c39afecb3 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-24  Richard Guenther  <rguenther@suse.de>
+
+       * fold-const.c (fold_comparison): Fold &a < &a + 4 even
+       with -fno-strict-overflow.
+
 2011-08-24  Richard Guenther  <rguenther@suse.de>
 
        * tree-vectorizer.c (vect_print_dump_info): Avoid the
index dcd6989b285522e50603334e9c6a5fc7eed7ea20..01c5570e28bf72bbbbdc7b8e9f907f151f9c99a5 100644 (file)
@@ -8738,6 +8738,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
                   && operand_equal_p (offset0, offset1, 0)))
              && (code == EQ_EXPR
                  || code == NE_EXPR
+                 || (indirect_base0 && DECL_P (base0))
                  || POINTER_TYPE_OVERFLOW_UNDEFINED))
 
            {
@@ -8777,6 +8778,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
             6.5.6/8 and /9 with respect to the signed ptrdiff_t.  */
          else if (bitpos0 == bitpos1
                   && ((code == EQ_EXPR || code == NE_EXPR)
+                      || (indirect_base0 && DECL_P (base0))
                       || POINTER_TYPE_OVERFLOW_UNDEFINED))
            {
              /* By converting to signed size type we cover middle-end pointer