summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-17 09:50:12 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-17 09:50:12 +0000
commit5991c03b5473cc17beed4c315d28fb3671831aa9 (patch)
tree3961519cc0d1eccf6b3ae1c44ead9b5f4397ec3a
parente5a4218e5e60b0f0eed24114bec3af16635f0a55 (diff)
downloadgcc-5991c03b5473cc17beed4c315d28fb3671831aa9.tar.gz
2010-08-17 Richard Guenther <rguenther@suse.de>
* fold-const.c (fold_comparison): Strip nops inside POINTER_PLUS_EXPR. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163298 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 e6f43ed6d78..f46429ee208 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-17 Richard Guenther <rguenther@suse.de>
+
+ * fold-const.c (fold_comparison): Strip nops inside
+ POINTER_PLUS_EXPR.
+
2010-08-17 Shujing Zhao <pearly.zhao@oracle.com>
PR c/40563
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index d63411ea89a..02ddac57da4 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -8683,6 +8683,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
else if (TREE_CODE (arg0) == POINTER_PLUS_EXPR)
{
base0 = TREE_OPERAND (arg0, 0);
+ STRIP_SIGN_NOPS (base0);
if (TREE_CODE (base0) == ADDR_EXPR)
{
base0 = TREE_OPERAND (base0, 0);
@@ -8705,6 +8706,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
else if (TREE_CODE (arg1) == POINTER_PLUS_EXPR)
{
base1 = TREE_OPERAND (arg1, 0);
+ STRIP_SIGN_NOPS (base1);
if (TREE_CODE (base1) == ADDR_EXPR)
{
base1 = TREE_OPERAND (base1, 0);