From 909d92883f3526ac0b87cc3b0904285ff997e21c Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 16 Dec 2011 14:31:14 +0000 Subject: [PATCH] 2011-12-16 Richard Guenther PR lto/51572 * dwarf2out.c (gen_type_die_with_usage): Use the context of the TYPE_DECL as well if it is file-scope. * gcc.dg/lto/pr51572-1_0.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182401 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/dwarf2out.c | 5 +++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/lto/pr51572-1_0.c | 9 +++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/lto/pr51572-1_0.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 44e31b5..94ebbc4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-12-16 Richard Guenther + + PR lto/51572 + * dwarf2out.c (gen_type_die_with_usage): Use the context of + the TYPE_DECL as well if it is file-scope. + 2011-12-15 DJ Delorie * config/rl78/rl78.md (return): Rename to rl78_return. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 768ecaf..d5f469c 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -18842,8 +18842,9 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die, /* Use the DIE of the containing namespace as the parent DIE of the type description DIE we want to generate. */ - if (DECL_CONTEXT (TYPE_NAME (type)) - && TREE_CODE (DECL_CONTEXT (TYPE_NAME (type))) == NAMESPACE_DECL) + if (DECL_FILE_SCOPE_P (TYPE_NAME (type)) + || (DECL_CONTEXT (TYPE_NAME (type)) + && TREE_CODE (DECL_CONTEXT (TYPE_NAME (type))) == NAMESPACE_DECL)) context_die = get_context_die (DECL_CONTEXT (TYPE_NAME (type))); TREE_ASM_WRITTEN (type) = 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c38491b..21b44c6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-12-16 Richard Guenther + + PR lto/51572 + * gcc.dg/lto/pr51572-1_0.c: New testcase. + 2011-12-15 Jason Merrill PR c++/51458 diff --git a/gcc/testsuite/gcc.dg/lto/pr51572-1_0.c b/gcc/testsuite/gcc.dg/lto/pr51572-1_0.c new file mode 100644 index 0000000..dfe5297 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr51572-1_0.c @@ -0,0 +1,9 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -flto -g } } } */ + +typedef int T; +void fn (void) +{ + static T t; +} +int main() {} -- 2.7.4