aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-01-24 11:01:29 +0000
committerJakub Jelinek <jakub@redhat.com>2004-01-24 11:01:29 +0000
commitf02d7e274a2aa50ce648bfb5a54d803c6e0f8770 (patch)
tree80619cfb79cfe4992a98b70a94b5b710e8868a5d
parent7fc5bedc8b572859bbbf18b896878055887d82c4 (diff)
* simplify-rtx.c (simplify_relational_operation): Don't
simplify address == constant into address + -constant == 0. * gcc.dg/20040123-1.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@76490 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/simplify-rtx.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/20040123-1.c12
4 files changed, 23 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index edb69224979..77bfc8784c8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-24 Jakub Jelinek <jakub@redhat.com>
+
+ * simplify-rtx.c (simplify_relational_operation): Don't
+ simplify address == constant into address + -constant == 0.
+
2004-01-24 Kazu Hirata <kazu@cs.umass.edu>
* gcc.c (process_command): Don't internationalize the
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index cebbf04b460..7f6b549b0fb 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2530,6 +2530,8 @@ simplify_relational_operation (enum rtx_code code, enum machine_mode mode,
&& ! ((GET_CODE (op0) == REG || GET_CODE (trueop0) == CONST_INT)
&& (GET_CODE (op1) == REG || GET_CODE (trueop1) == CONST_INT))
&& 0 != (tem = simplify_binary_operation (MINUS, mode, op0, op1))
+ /* We cannot do this for == or != if tem is a nonzero address. */
+ && ((code != EQ && code != NE) || ! nonzero_address_p (tem))
&& code != GTU && code != GEU && code != LTU && code != LEU)
return simplify_relational_operation (signed_condition (code),
mode, tem, const0_rtx);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 370c1aa63e3..ed7cb61ae4c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-24 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/20040123-1.c: New test.
+
2004-01-23 Zack Weinberg <zack@codesourcery.com>
* gcc.dg/builtins-30.c: Move dg-warning marks to the proper lines.
diff --git a/gcc/testsuite/gcc.dg/20040123-1.c b/gcc/testsuite/gcc.dg/20040123-1.c
new file mode 100644
index 00000000000..2a73382dd94
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20040123-1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler "abort" } } */
+
+extern void abort (void);
+extern char a[];
+
+void foo (void)
+{
+ if ((void *) a == (void *) 0x4000UL)
+ abort ();
+}