mirror of
https://gcc.gnu.org/git/gcc.git
synced 2026-02-22 03:46:53 -05:00
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:
committed by
Andrew Pinski
parent
2175b089ce
commit
bcb52f6a36
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
15
gcc/testsuite/gcc.dg/pr30045.c
Normal file
15
gcc/testsuite/gcc.dg/pr30045.c
Normal 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;
|
||||
}
|
||||
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user