diff options
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr43942.c | 33 | ||||
-rw-r--r-- | gcc/tree.c | 3 |
4 files changed, 45 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a428b9417a..7655f239d35 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-04-30 Jakub Jelinek <jakub@redhat.com> + + PR debug/43942 + * tree.c (auto_var_in_fn_p): Return false for DECL_EXTERNAL vars. + 2010-04-30 Hariharan Sandanagobalane <hariharan@picochip.com> * config/picochip/picochip.c (picochip_legitimize_address): Define. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9aaaf8290c4..886e8103212 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-04-30 Jakub Jelinek <jakub@redhat.com> + + PR debug/43942 + * c-c++-common/pr43942.c: New test. + 2009-04-30 Steven Bosscher <steven@gcc.gnu.org> * gcc.dg/lto/20091216-1_0.c: Adjust test case to avoid diff --git a/gcc/testsuite/c-c++-common/pr43942.c b/gcc/testsuite/c-c++-common/pr43942.c new file mode 100644 index 00000000000..3d97db6624e --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr43942.c @@ -0,0 +1,33 @@ +/* PR debug/43942 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +extern int f1 (int); + +int +f2 (int x) +{ + extern int v; + return f1 (x); +} + +void +f3 (void) +{ + f2 (0); +} + +static inline int +f4 (int x) +{ + extern int w; + if (w) + return f1 (x); + return 0; +} + +void +f5 (void) +{ + f4 (0); +} diff --git a/gcc/tree.c b/gcc/tree.c index 8eeecff7122..24482af95d8 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7936,7 +7936,8 @@ bool auto_var_in_fn_p (const_tree var, const_tree fn) { return (DECL_P (var) && DECL_CONTEXT (var) == fn - && (((TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL) + && ((((TREE_CODE (var) == VAR_DECL && ! DECL_EXTERNAL (var)) + || TREE_CODE (var) == PARM_DECL) && ! TREE_STATIC (var)) || TREE_CODE (var) == LABEL_DECL || TREE_CODE (var) == RESULT_DECL)); |