Message ID | 5509AFFF.6070408@redhat.com |
---|---|
State | New |
Headers | show |
On 03/18/2015 01:03 PM, Aldy Hernandez wrote: > By the way Jason, is there any reason we previously called > equate_decl_number_to_die() only for abstract instances?: So that multiple concrete instances can find the abstract instance. Why isn't DECL_ABSTRACT_P set the first time you get here for the label in question? > I don't see anything else in dwarf2out.c doing a > lookup_decl_die() on a LABEL_DECL, so I don't even know why the > equate_decl_number_to_die() is even there. add_abstract_origin_attribute uses lookup_decl_die. Jason
On 03/18/2015 01:59 PM, Jason Merrill wrote: > On 03/18/2015 01:03 PM, Aldy Hernandez wrote: >> By the way Jason, is there any reason we previously called >> equate_decl_number_to_die() only for abstract instances?: > > So that multiple concrete instances can find the abstract instance. Ah, I see. > > Why isn't DECL_ABSTRACT_P set the first time you get here for the label > in question? Oh, that part was working fine. The testcase that prompted this whole thing had nothing to do with DECL_ABSTRACT_P. I was just curious if I could remove the call to equate_decl_number_to_die, but I see it's needed. > >> I don't see anything else in dwarf2out.c doing a >> lookup_decl_die() on a LABEL_DECL, so I don't even know why the >> equate_decl_number_to_die() is even there. > > add_abstract_origin_attribute uses lookup_decl_die. Thanks. Aldy
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 30c6cc6..92f4903 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -19725,14 +19725,20 @@ static void gen_label_die (tree decl, dw_die_ref context_die) { tree origin = decl_ultimate_origin (decl); - dw_die_ref lbl_die = new_die (DW_TAG_label, context_die, decl); + dw_die_ref lbl_die = lookup_decl_die (decl); rtx insn; char label[MAX_ARTIFICIAL_LABEL_BYTES]; - if (origin != NULL) - add_abstract_origin_attribute (lbl_die, origin); - else - add_name_and_src_coords_attributes (lbl_die, decl); + if (!lbl_die) + { + lbl_die = new_die (DW_TAG_label, context_die, decl); + equate_decl_number_to_die (decl, lbl_die); + + if (origin != NULL) + add_abstract_origin_attribute (lbl_die, origin); + else + add_name_and_src_coords_attributes (lbl_die, decl); + } if (DECL_ABSTRACT_P (decl)) equate_decl_number_to_die (decl, lbl_die);