diff options
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 9077a64b98e..e7e5788c4e3 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -19129,7 +19129,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) DW_TAG_common_block and DW_TAG_variable. */ loc = loc_list_from_tree (com_decl, 2, NULL); } - else if (DECL_EXTERNAL (decl)) + else if (DECL_EXTERNAL (decl_or_origin)) add_AT_flag (com_die, DW_AT_declaration, 1); if (want_pubnames ()) add_pubname_string (cnam, com_die); /* ??? needed? */ @@ -19144,9 +19144,9 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) remove_AT (com_die, DW_AT_declaration); } var_die = new_die (DW_TAG_variable, com_die, decl); - add_name_and_src_coords_attributes (var_die, decl); - add_type_attribute (var_die, TREE_TYPE (decl), decl_quals (decl), - context_die); + add_name_and_src_coords_attributes (var_die, decl_or_origin); + add_type_attribute (var_die, TREE_TYPE (decl_or_origin), + decl_quals (decl_or_origin), context_die); add_AT_flag (var_die, DW_AT_external, 1); if (loc) { @@ -19167,9 +19167,10 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) } add_AT_location_description (var_die, DW_AT_location, loc); } - else if (DECL_EXTERNAL (decl)) + else if (DECL_EXTERNAL (decl_or_origin)) add_AT_flag (var_die, DW_AT_declaration, 1); - equate_decl_number_to_die (decl, var_die); + if (decl) + equate_decl_number_to_die (decl, var_die); return; } |