re PR tree-optimization/30045 (ICE in nonnull_arg_p with the CHAIN decl)

2007-03-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>

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

2007-03-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>

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

From-SVN: r122770
This commit is contained in:
Andrew Pinski
2007-03-09 23:24:53 +00:00
committed by Andrew Pinski
parent 2175b089ce
commit bcb52f6a36
4 changed files with 30 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
2007-03-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/30045
* tree-vrp.c (nonnull_arg_p): Treat the static decl as always
non null.
2007-03-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/30729

View File

@@ -1,3 +1,8 @@
2007-03-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/30045
* gcc.dg/pr30045.c: New test.
2007-03-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/30729

View File

@@ -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;
}

View 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));