From: Jakub Jelinek Date: Tue, 17 Mar 2009 17:43:52 +0000 (+0100) Subject: re PR debug/39412 (ICE in gen_tagged_type_instantiation_die) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=16e60c1706a8abf971d1ae216a33cc7e2f29e3c5;p=platform%2Fupstream%2Fgcc.git re PR debug/39412 (ICE in gen_tagged_type_instantiation_die) PR debug/39412 * dwarf2out.c (gen_inlined_enumeration_type_die, gen_inlined_structure_type_die, gen_inlined_union_type_die, gen_tagged_type_instantiation_die): Removed. (gen_decl_die): For TYPE_DECL_IS_STUB with non-NULL decl_origin do nothing. * gcc.dg/debug/pr39412.c: New test. From-SVN: r144909 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8e08d70..18264af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2009-03-17 Jakub Jelinek + + PR debug/39412 + * dwarf2out.c (gen_inlined_enumeration_type_die, + gen_inlined_structure_type_die, gen_inlined_union_type_die, + gen_tagged_type_instantiation_die): Removed. + (gen_decl_die): For TYPE_DECL_IS_STUB with non-NULL decl_origin + do nothing. + 2009-03-17 Janis Johnson PR testsuite/38526 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 63301a5..6711777 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -5149,9 +5149,6 @@ static void gen_descr_array_type_die (tree, struct array_descr_info *, dw_die_re #if 0 static void gen_entry_point_die (tree, dw_die_ref); #endif -static void gen_inlined_enumeration_type_die (tree, dw_die_ref); -static void gen_inlined_structure_type_die (tree, dw_die_ref); -static void gen_inlined_union_type_die (tree, dw_die_ref); static dw_die_ref gen_enumeration_type_die (tree, dw_die_ref); static dw_die_ref gen_formal_parameter_die (tree, tree, dw_die_ref); static void gen_unspecified_parameters_die (tree, dw_die_ref); @@ -5172,7 +5169,6 @@ static void gen_struct_or_union_type_die (tree, dw_die_ref, static void gen_subroutine_type_die (tree, dw_die_ref); static void gen_typedef_die (tree, dw_die_ref); static void gen_type_die (tree, dw_die_ref); -static void gen_tagged_type_instantiation_die (tree, dw_die_ref); static void gen_block_die (tree, dw_die_ref, int); static void decls_for_scope (tree, dw_die_ref, int); static int is_redundant_typedef (const_tree); @@ -13149,18 +13145,6 @@ retry_incomplete_types (void) gen_type_die (VEC_index (tree, incomplete_types, i), comp_unit_die); } -/* Generate a DIE to represent an inlined instance of an enumeration type. */ - -static void -gen_inlined_enumeration_type_die (tree type, dw_die_ref context_die) -{ - dw_die_ref type_die = new_die (DW_TAG_enumeration_type, context_die, type); - - /* We do not check for TREE_ASM_WRITTEN (type) being set, as the type may - be incomplete and such types are not marked. */ - add_abstract_origin_attribute (type_die, type); -} - /* Determine what tag to use for a record type. */ static enum dwarf_tag @@ -13185,30 +13169,6 @@ record_type_tag (tree type) } } -/* Generate a DIE to represent an inlined instance of a structure type. */ - -static void -gen_inlined_structure_type_die (tree type, dw_die_ref context_die) -{ - dw_die_ref type_die = new_die (record_type_tag (type), context_die, type); - - /* We do not check for TREE_ASM_WRITTEN (type) being set, as the type may - be incomplete and such types are not marked. */ - add_abstract_origin_attribute (type_die, type); -} - -/* Generate a DIE to represent an inlined instance of a union type. */ - -static void -gen_inlined_union_type_die (tree type, dw_die_ref context_die) -{ - dw_die_ref type_die = new_die (DW_TAG_union_type, context_die, type); - - /* We do not check for TREE_ASM_WRITTEN (type) being set, as the type may - be incomplete and such types are not marked. */ - add_abstract_origin_attribute (type_die, type); -} - /* Generate a DIE to represent an enumeration type. Note that these DIEs include all of the information about the enumeration values also. Each enumerated type name/value is listed as a child of the enumerated type @@ -14835,46 +14795,6 @@ gen_type_die (tree type, dw_die_ref context_die) gen_type_die_with_usage (type, context_die, DINFO_USAGE_DIR_USE); } -/* Generate a DIE for a tagged type instantiation. */ - -static void -gen_tagged_type_instantiation_die (tree type, dw_die_ref context_die) -{ - if (type == NULL_TREE || type == error_mark_node) - return; - - /* We are going to output a DIE to represent the unqualified version of - this type (i.e. without any const or volatile qualifiers) so make sure - that we have the main variant (i.e. the unqualified version) of this - type now. */ - gcc_assert (type == type_main_variant (type)); - - /* Do not check TREE_ASM_WRITTEN (type) as it may not be set if this is - an instance of an unresolved type. */ - - switch (TREE_CODE (type)) - { - case ERROR_MARK: - break; - - case ENUMERAL_TYPE: - gen_inlined_enumeration_type_die (type, context_die); - break; - - case RECORD_TYPE: - gen_inlined_structure_type_die (type, context_die); - break; - - case UNION_TYPE: - case QUAL_UNION_TYPE: - gen_inlined_union_type_die (type, context_die); - break; - - default: - gcc_unreachable (); - } -} - /* Generate a DW_TAG_lexical_block DIE followed by DIEs to represent all of the things which are local to the given block. */ @@ -15315,14 +15235,14 @@ gen_decl_die (tree decl, tree origin, dw_die_ref context_die) of some type tag, if the given TYPE_DECL is marked as having been instantiated from some other (original) TYPE_DECL node (e.g. one which was generated within the original definition of an inline function) we - have to generate a special (abbreviated) DW_TAG_structure_type, - DW_TAG_union_type, or DW_TAG_enumeration_type DIE here. */ - if (TYPE_DECL_IS_STUB (decl) && decl_ultimate_origin (decl) != NULL_TREE - && is_tagged_type (TREE_TYPE (decl))) - { - gen_tagged_type_instantiation_die (TREE_TYPE (decl), context_die); - break; - } + used to generate a special (abbreviated) DW_TAG_structure_type, + DW_TAG_union_type, or DW_TAG_enumeration_type DIE here. But nothing + should be actually referencing those DIEs, as variable DIEs with that + type would be emitted already in the abstract origin, so it was always + removed during unused type prunning. Don't add anything in this + case. */ + if (TYPE_DECL_IS_STUB (decl) && decl_ultimate_origin (decl) != NULL_TREE) + break; if (is_redundant_typedef (decl)) gen_type_die (TREE_TYPE (decl), context_die); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f91e99c..d93660e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-03-17 Jakub Jelinek + + PR debug/39412 + * gcc.dg/debug/pr39412.c: New test. + 2009-03-17 Janis Johnson PR testsuite/38526 diff --git a/gcc/testsuite/gcc.dg/debug/pr39412.c b/gcc/testsuite/gcc.dg/debug/pr39412.c new file mode 100644 index 0000000..71b7b5e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr39412.c @@ -0,0 +1,16 @@ +/* PR debug/39412 */ +/* { dg-do compile } */ + +struct S { int i; }; + +inline void +bar (const void *x, unsigned long y) +{ + const union { struct S a[y]; } *u = x; +} + +void +foo (const void *x, unsigned long y) +{ + bar (x, y); +}