OSDN Git Service

2006-12-19 Andrew Pinski <pinskia@gmail.com>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Dec 2006 05:00:50 +0000 (05:00 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Dec 2006 05:00:50 +0000 (05:00 +0000)
        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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120069 138bc75d-0d04-0410-961f-82ee72b054a4

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

index d692458..a5aadaf 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 538cba6..2f5d6b7 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 483607e..302a620 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));