summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-24 12:51:45 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-24 12:51:45 +0000
commit9643722d177336cfdc441619a051d7be0266d6fc (patch)
treef3636ed7d97b6c98eeb95655a19256b3a5b08856
parentb330ad86716036579a7c176f2ff499c476805439 (diff)
downloadgcc-9643722d177336cfdc441619a051d7be0266d6fc.tar.gz
2011-08-24 Richard Guenther <rguenther@suse.de>
* fold-const.c (fold_comparison): Fold &a < &a + 4 even with -fno-strict-overflow. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178036 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/fold-const.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7e1db3d1203..2c4aadbe186 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
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
file and location clutter when dumping to dump files.
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index dcd6989b285..01c5570e28b 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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