]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/38984 (NULL pointers always considered distinct by PTA, even...
authorPaolo Bonzini <bonzini@gnu.org>
Wed, 28 Jan 2009 08:02:31 +0000 (08:02 +0000)
committerPaolo Bonzini <bonzini@gcc.gnu.org>
Wed, 28 Jan 2009 08:02:31 +0000 (08:02 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr38984.c [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index 5300a8627bc7cb5c3cf14d1952bdc6e5220b2d75..2727cc2ff2340af4e789079736d006b0eeef6a68 100644 (file)
@@ -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
index 8f1ceb8d2a07c1a2ff272d839cfc11718353354c..7721a56f2bff82abbbfbf9a9f52b9d91501d4f75 100644 (file)
@@ -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 (file)
index 0000000..0ba7273
--- /dev/null
@@ -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" } } */
+
+
index cae478afbf3368d91fae7950416d11b97b241ef8..21566bbe5d82aa8d5ab65b7c0c5ac3b7fb394dd9 100644 (file)
@@ -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;