re PR debug/19406 (ICE: in force_decl_die, at dwarf2out.c:12442)

PR c++/19406
	* dwarf2out.c (gen_type_die_for_member): Handle FIELD_DECL.
	(dwarf2out_imported_module_or_decl): Use gen_type_die_for_member
	for FIELD_DECLs.

	* g++.dg/debug/using1.C: New test.

From-SVN: r97373
This commit is contained in:
Jakub Jelinek 2005-04-01 09:47:27 +02:00 committed by Jakub Jelinek
parent fff72cc4ee
commit a288c5cd8c
4 changed files with 66 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2005-04-01 Jakub Jelinek <jakub@redhat.com>
PR c++/19406
* dwarf2out.c (gen_type_die_for_member): Handle FIELD_DECL.
(dwarf2out_imported_module_or_decl): Use gen_type_die_for_member
for FIELD_DECLs.
2005-04-01 Kazu Hirata <kazu@cs.umass.edu>
* doc/contrib.texi, doc/invoke.texi, doc/tm.texi: Fix typos.

View File

@ -11222,13 +11222,27 @@ gen_type_die_for_member (tree type, tree member, dw_die_ref context_die)
if (TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (type))
&& ! lookup_decl_die (member))
{
dw_die_ref type_die;
gcc_assert (!decl_ultimate_origin (member));
push_decl_scope (type);
type_die = lookup_type_die (type);
if (TREE_CODE (member) == FUNCTION_DECL)
gen_subprogram_die (member, lookup_type_die (type));
gen_subprogram_die (member, type_die);
else if (TREE_CODE (member) == FIELD_DECL)
{
/* Ignore the nameless fields that are used to skip bits but handle
C++ anonymous unions and structs. */
if (DECL_NAME (member) != NULL_TREE
|| TREE_CODE (TREE_TYPE (member)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (member)) == RECORD_TYPE)
{
gen_type_die (member_declared_type (member), type_die);
gen_field_die (member, type_die);
}
}
else
gen_variable_die (member, lookup_type_die (type));
gen_variable_die (member, type_die);
pop_decl_scope ();
}
@ -12935,7 +12949,29 @@ dwarf2out_imported_module_or_decl (tree decl, tree context)
if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == CONST_DECL)
at_import_die = force_type_die (TREE_TYPE (decl));
else
at_import_die = force_decl_die (decl);
{
at_import_die = lookup_decl_die (decl);
if (!at_import_die)
{
/* If we're trying to avoid duplicate debug info, we may not have
emitted the member decl for this field. Emit it now. */
if (TREE_CODE (decl) == FIELD_DECL)
{
tree type = DECL_CONTEXT (decl);
dw_die_ref type_context_die;
if (TYPE_CONTEXT (type))
if (TYPE_P (TYPE_CONTEXT (type)))
type_context_die = force_type_die (TYPE_CONTEXT (type));
else
type_context_die = force_decl_die (TYPE_CONTEXT (type));
else
type_context_die = comp_unit_die;
gen_type_die_for_member (type, decl, type_context_die);
}
at_import_die = force_decl_die (decl);
}
}
/* OK, now we have DIEs for decl as well as scope. Emit imported die. */
if (TREE_CODE (decl) == NAMESPACE_DECL)

View File

@ -1,3 +1,8 @@
2005-04-01 Jakub Jelinek <jakub@redhat.com>
PR c++/19406
* g++.dg/debug/using1.C: New test.
2005-04-01 Hans-Peter Nilsson <hp@axis.com>
PR middle-end/20524

View File

@ -0,0 +1,15 @@
// PR c++/19406
// { dg-do compile }
struct A
{
virtual int foo();
double d;
};
struct B : public A
{
A::d;
};
B b;