re PR debug/43942 (-fcompare-debug faulure with external declaration in function.)

PR debug/43942
	* tree.c (auto_var_in_fn_p): Return false for DECL_EXTERNAL vars.

	* c-c++-common/pr43942.c: New test.

From-SVN: r158931
This commit is contained in:
Jakub Jelinek 2010-04-30 13:24:16 +02:00 committed by Jakub Jelinek
parent 1179ee883f
commit a07ecd2bc4
4 changed files with 45 additions and 1 deletions

View File

@ -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.

View File

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

View File

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

View File

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