This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix the most annoying LTO -g ICE in dwarf2out.c
On Tue, 12 Oct 2010, Richard Guenther wrote:
> On Mon, 11 Oct 2010, Jason Merrill wrote:
>
> > On 10/08/2010 10:58 AM, Richard Guenther wrote:
> > > Jason, does this sound like a reasonable workaround (yes, I'll be
> > > eventually looking for a way to avoid the situation in the first place,
> > > but it involves type-merging, a very fragile piece of code ...)?
> >
> > It seems like a fine workaround for release branches, but when ENABLE_CHECKING
> > is on I think we want it to crash as motivation for fixing the real bug.
>
> Ok, that works for me. I'll wrap the bailout in ENABLE_CHECKING and
> add an assert if checking is enabled.
On a second thought, as the problem happens here:
static inline void
add_pure_or_virtual_attribute (dw_die_ref die, tree func_decl)
{
if (DECL_VINDEX (func_decl))
{
add_AT_unsigned (die, DW_AT_virtuality, DW_VIRTUALITY_virtual);
if (host_integerp (DECL_VINDEX (func_decl), 0))
add_AT_loc (die, DW_AT_vtable_elem_location,
new_loc_descr (DW_OP_constu,
tree_low_cst (DECL_VINDEX (func_decl),
0),
0));
/* GNU extension: Record what type this method came from originally.
*/
if (debug_info_level > DINFO_LEVEL_TERSE
&& DECL_CONTEXT (func_decl))
add_AT_die_ref (die, DW_AT_containing_type,
lookup_type_die (DECL_CONTEXT (func_decl)));
DECL_CONTEXT is non-NULL but lookup_type_die fails. We can also
not emit DW_AT_containing_type if the lookup failed (similar to the
DECL_CONTEXT check), or even use force_type_die here. Both work
for the testcase. A workaround on the LTO side would be to clear
DECL_CONTEXT on such functions.
Thanks,
Richard.