]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/30045 (ICE in nonnull_arg_p with the CHAIN decl)
authorAndrew Pinski <pinskia@gcc.gnu.org>
Wed, 20 Dec 2006 05:00:50 +0000 (21:00 -0800)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Wed, 20 Dec 2006 05:00:50 +0000 (21:00 -0800)
2006-12-19  Andrew Pinski  <pinskia@gmail.com>

        PR tree-opt/30045
        * tree-vrp.c (nonnull_arg_p): Treat the static decl as always
        non null.

2006-12-19  Andrew Pinski  <pinskia@gmail.com>

        PR tree-opt/30045
        * gcc.dg/pr30045.c: New test

From-SVN: r120069

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr30045.c [new file with mode: 0644]
gcc/tree-vrp.c

index d69245896c0854e3855ea815465d273c12fab9f8..a5aadaf18f526d26f6d0062ad09e98d8f86869eb 100644 (file)
@@ -1,3 +1,9 @@
+2006-12-19  Andrew Pinski  <pinskia@gmail.com>
+
+       PR tree-opt/30045
+       * tree-vrp.c (nonnull_arg_p): Treat the static decl as always
+       non null.
+
 2006-12-20  Ben Elliston  <bje@au.ibm.com>
 
        * doc/invoke.texi (Optimize Options): Typo fix.
@@ -18,8 +24,8 @@
 2006-12-19  Paolo Bonzini  <bonzini@gnu.org>
 
        PR bootstrap/29544
-        * gcc/Makefile.in (STAGE1_CHECKING): Rename to...
-        (STAGE1_CHECKING_CFLAGS): ... this.
+       * gcc/Makefile.in (STAGE1_CHECKING): Rename to...
+       (STAGE1_CHECKING_CFLAGS): ... this.
 
 2006-12-18  Andrew Pinski  <pinskia@gmail.com>
 
index 538cba6cac9c6d3e53202f5a1d2294346663f4c1..2f5d6b7ae36ca65d563e2d3c3ba1abdc2b385ca0 100644 (file)
@@ -1,3 +1,8 @@
+2006-12-19  Andrew Pinski  <pinskia@gmail.com>
+
+       PR tree-opt/30045
+       * gcc.dg/pr30045.c: New test.
+
 2006-12-20  Ben Elliston  <bje@au.ibm.com>
 
        * gcc.dg/20020312-2.c: Add a case for __SPU__.
diff --git a/gcc/testsuite/gcc.dg/pr30045.c b/gcc/testsuite/gcc.dg/pr30045.c
new file mode 100644 (file)
index 0000000..6dd22a1
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-inline" }  */
+int f(int *a)
+{
+  int  __attribute__((nonnull(1))) g(int *b)
+  {
+    int **c = &a;
+    if (b)
+      return *a + **c;
+    return *b;
+  }
+  if (a)
+    return g(a);
+  return 1;
+}
index 483607ec5544f8a46d3e86ad419e7e338b9372eb..302a6201bf04acfd6eb2db07daa99f8f66e4b335 100644 (file)
@@ -102,6 +102,10 @@ nonnull_arg_p (tree arg)
 
   gcc_assert (TREE_CODE (arg) == PARM_DECL && POINTER_TYPE_P (TREE_TYPE (arg)));
 
+  /* The static chain decl is always non null.  */
+  if (arg == cfun->static_chain_decl)
+    return true;
+
   fntype = TREE_TYPE (current_function_decl);
   attrs = lookup_attribute ("nonnull", TYPE_ATTRIBUTES (fntype));