From: Jason Merrill Date: Fri, 3 Dec 2010 20:08:28 +0000 (-0500) Subject: re PR debug/46123 (ICE: in output_aranges, at dwarf2out.c:11531 with -feliminate... X-Git-Tag: releases/gcc-4.5.2~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f6949148a8626a6579a4cae9248b885d0ad1cc9;p=thirdparty%2Fgcc.git re PR debug/46123 (ICE: in output_aranges, at dwarf2out.c:11531 with -feliminate-dwarf2-dups -g) PR debug/46123 * dwarf2out.c (gen_type_die_with_usage): Don't put local types in a declaration DIE. From-SVN: r167441 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2cae32896178..a1c6769085f1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-12-03 Jason Merrill + + PR debug/46123 + * dwarf2out.c (gen_type_die_with_usage): Don't put local types in + a declaration DIE. + 2010-12-03 Rainer Orth Backport from mainline: diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 0fe8b636bf23..802ba3d6d37c 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -19125,6 +19125,10 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die, out yet, use a NULL context for now; it will be fixed up in decls_for_scope. */ context_die = lookup_decl_die (TYPE_CONTEXT (type)); + /* A declaration DIE doesn't count; nested types need to go in the + specification. */ + if (context_die && is_declaration_die (context_die)) + context_die = NULL; need_pop = 0; } else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 72416028397d..3f804515bf33 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-12-03 Jakub Jelinek + + PR debug/46123 + * g++.dg/debug/pr46123.C: New test. + * g++.dg/debug/dwarf2/pr46123.C: New test. + 2010-12-03 Jason Merrill PR c++/46058 diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr46123.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr46123.C new file mode 100644 index 000000000000..eee192c26873 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr46123.C @@ -0,0 +1,47 @@ +// PR debug/46123 +// { dg-do compile } +// { dg-options "-gdwarf-4" } + +struct foo +{ + static int bar () + { + int i; + static int baz = 1; + { + static int baz = 2; + i = baz++; + } + { + struct baz + { + static int m () + { + static int n; + return n += 10; + } + }; + baz a; + i += a.m (); + } + { + static int baz = 3; + i += baz; + baz += 30; + } + i += baz; + baz += 60; + return i; + } +}; + +int main () +{ + foo x; + + if (x.bar () != 16) + return 1; + if (x.bar() != 117) + return 1; + return 0; +} diff --git a/gcc/testsuite/g++.dg/debug/pr46123.C b/gcc/testsuite/g++.dg/debug/pr46123.C new file mode 100644 index 000000000000..9e115cd06da8 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/pr46123.C @@ -0,0 +1,47 @@ +// PR debug/46123 +// { dg-do compile } +// { dg-options "-g -feliminate-dwarf2-dups" } + +struct foo +{ + static int bar () + { + int i; + static int baz = 1; + { + static int baz = 2; + i = baz++; + } + { + struct baz + { + static int m () + { + static int n; + return n += 10; + } + }; + baz a; + i += a.m (); + } + { + static int baz = 3; + i += baz; + baz += 30; + } + i += baz; + baz += 60; + return i; + } +}; + +int main () +{ + foo x; + + if (x.bar () != 16) + return 1; + if (x.bar() != 117) + return 1; + return 0; +}