Message ID | 20140212222008.GS20378@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
> gen_subprogram_die is often called more than once for the same decl > (e.g. the first time through force_decl_die etc.), but it always > unconditionally calls add_calling_convention_attribute which thus > may add the attributes several times. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk? Looks good to me. > Alternatively, we could avoid the add_calling_convention_attribute > call in gen_subprogram_die if subr_die == orig_die, i.e. if we have > already processed the decl once, hopefully the calling conventions would be > the same in all cases. s/orig_die/old_die/ This sounds a little more efficient -- no calls to get_AT just to see if the attribute has already been added. I've got a slight preference for your alternate proposal (assuming it works). -cary
--- gcc/dwarf2out.c.jj 2014-01-30 20:31:19.000000000 +0100 +++ gcc/dwarf2out.c 2014-02-12 18:26:41.098486306 +0100 @@ -16873,13 +16873,15 @@ add_calling_convention_attribute (dw_die rely on the old way, which we thus keep. */ value = DW_CC_program; - if (dwarf_version >= 4 || !dwarf_strict) + if ((dwarf_version >= 4 || !dwarf_strict) + && !get_AT (subr_die, DW_AT_main_subprogram)) add_AT_flag (subr_die, DW_AT_main_subprogram, 1); } /* Only add the attribute if the backend requests it, and is not DW_CC_normal. */ - if (value && (value != DW_CC_normal)) + if (value && value != DW_CC_normal + && !get_AT (subr_die, DW_AT_calling_convention)) add_AT_unsigned (subr_die, DW_AT_calling_convention, value); }