aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2009-01-28 08:02:31 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2009-01-28 08:02:31 +0000
commit89ebafc6cdbfe4f67d017844f50b3810fd9e1399 (patch)
tree3cd192be101ee3c3c1d45220682f7ba74918cf0b /gcc
parentbef3c57babac2e7ff368cb226a962644575c22e0 (diff)
downloadgcc-89ebafc6cdbfe4f67d017844f50b3810fd9e1399.zip
gcc-89ebafc6cdbfe4f67d017844f50b3810fd9e1399.tar.gz
gcc-89ebafc6cdbfe4f67d017844f50b3810fd9e1399.tar.bz2
re PR tree-optimization/38984 (NULL pointers always considered distinct by PTA, even with -fno-delete-null-pointer-checks)
gcc: 2009-01-28 Paolo Bonzini <bonzini@gnu.org> PR tree-optimization/38984 * tree-ssa-structalias.c (get_constraints_for_1): Do not use the nothing_id variable if -fno-delete-null-pointer-checks. gcc/testsuite: 2009-01-28 Paolo Bonzini <bonzini@gnu.org> PR tree-optimization/38984 * gcc.dg/pr38984.c: New XFAILed testcase. From-SVN: r143721
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr38984.c19
-rw-r--r--gcc/tree-ssa-structalias.c10
4 files changed, 38 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5300a86..2727cc2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-28 Paolo Bonzini <bonzini@gnu.org>
+
+ PR tree-optimization/38984
+ * tree-ssa-structalias.c (get_constraints_for_1): Do not use
+ the nothing_id variable if -fno-delete-null-pointer-checks.
+
2009-01-28 Uros Bizjak <ubizjak@gmail.com>
PR target/38988
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8f1ceb8..7721a56 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-28 Paolo Bonzini <bonzini@gnu.org>
+
+ PR tree-optimization/38984
+ * gcc.dg/pr38984.c: New XFAILed testcase.
+
2009-01-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37554
diff --git a/gcc/testsuite/gcc.dg/pr38984.c b/gcc/testsuite/gcc.dg/pr38984.c
new file mode 100644
index 0000000..0ba7273
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr38984.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-delete-null-pointer-checks -fdump-tree-optimized" }
+ * */
+
+int f(int *p)
+{
+ int a = *p;
+ int *null = 0;
+ *null = 5;
+ return *p == a;
+}
+
+/* Currently fails because of PR38985. */
+
+/* { dg-final { scan-tree-dump-times " = \\\*p" 2 "optimized" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-not "return 1" "optimized" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
+
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index cae478a..21566bb 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -3044,8 +3044,14 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p)
happens below, since it will fall into the default case. The only
case we know something about an integer treated like a pointer is
when it is the NULL pointer, and then we just say it points to
- NULL. */
- if (TREE_CODE (t) == INTEGER_CST
+ NULL.
+
+ Do not do that if -fno-delete-null-pointer-checks though, because
+ in that case *NULL does not fail, so it _should_ alias *anything.
+ It is not worth adding a new option or renaming the existing one,
+ since this case is relatively obscure. */
+ if (flag_delete_null_pointer_checks
+ && TREE_CODE (t) == INTEGER_CST
&& integer_zerop (t))
{
temp.var = nothing_id;