aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gcc.gnu.org>2009-08-28 13:32:29 -0700
committerCary Coutant <ccoutant@gcc.gnu.org>2009-08-28 13:32:29 -0700
commite6a83a8e9e211f45d862a81d22deb2aed8e66453 (patch)
treed2b2d979716740ba72c42ad6455dfd7dd75bff7e /gcc
parent059a5f9f1cbfacf7f1102f1e03c62d9da453879c (diff)
downloadgcc-e6a83a8e9e211f45d862a81d22deb2aed8e66453.zip
gcc-e6a83a8e9e211f45d862a81d22deb2aed8e66453.tar.gz
gcc-e6a83a8e9e211f45d862a81d22deb2aed8e66453.tar.bz2
re PR debug/41063 (ICE in output_die)
gcc/ChangeLog: PR debug/41063 * dwarf2out.c (gen_type_die_with_usage): Use proper context for struct/union/enum types local to a function. gcc/testsuite/ChangeLog: PR debug/41063 * g++.dg/debug/dwarf2/pr41063.C: New test. From-SVN: r151185
Diffstat (limited to 'gcc')
-rw-r--r--gcc/dwarf2out.c9
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/pr41063.C20
2 files changed, 29 insertions, 0 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 04f8758..aad6ee7 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -15573,6 +15573,15 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
context_die = lookup_type_die (TYPE_CONTEXT (type));
need_pop = 1;
}
+ else if (TYPE_CONTEXT (type) != NULL_TREE
+ && (TREE_CODE (TYPE_CONTEXT (type)) == FUNCTION_DECL))
+ {
+ /* If this type is local to a function that hasn't been written
+ 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));
+ need_pop = 0;
+ }
else
{
context_die = declare_in_namespace (type, context_die);
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr41063.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr41063.C
new file mode 100644
index 0000000..f23efef
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr41063.C
@@ -0,0 +1,20 @@
+// Contributed by Cary Coutant <ccoutant@google.com>
+// Origin: PR debug/41063
+// { dg-do compile }
+
+struct A {
+ virtual void run();
+};
+
+void test() {
+ struct B : public A {
+ void run() {
+ struct C : public A {
+ C() { }
+ B *b_;
+ };
+ C c;
+ }
+ };
+ B b;
+}