On 05/26/2017 10:12 AM, Pierre-Marie de Rodat wrote:
On 05/08/2017 06:27 PM, Jason Merrill wrote:
That seems like a bug; if gen_typedef_die is going to generate a DIE
for a cloned typedef, it needs to associate the type with the DIE.

Hm… gen_typedef_die generates a DIE for a DECL node, but modified_type_die look for a DIE for the corresponding TYPE, and of course the lookup returns NULL. So just removing the “if (DECL_ABSTRACT_P (decl))” condition in gen_typedef_die is not enough to make the crash go away.

Right, the bug seems to be generating the useless DIE in the first place.

gen_typedef_die does create a DIE for them, it just doesn't do it
properly.  But we could change gen_typedef_die to abort in that case,
making this comment correct.

Something like this, which also avoids routinely creating DIEs for
local typedefs that will only be pruned away later; this patch doesn't
change the size of .debug_info in cc1plus.

I tried this, but I got a crash when compiling the Ada runtime (g-awk.adb). I could not extract a reproducer, but the idea is that because of the call to set_decl_origin_self, some DECLs have themselves as DECL_ABSTRACT_ORIGIN. As a result, my patch in modified_type_die does not prevent execution from calling gen_typedef_die with a DECL that has a non-null abstract origin. So I have to soften the assertion so that this specific case was still allowed in gen_typedef_die.

Perhaps the DECL_ABSTRACT_ORIGIN check in my patch should be decl_ultimate_origin instead, which should return null in that case?

Jason

Reply via email to