[PATCH] Improve PR45089
Richard Guenther
rguenther@suse.de
Thu Nov 18 14:42:00 GMT 2010
As discussed this makes us not ICE for PR45089 when checking is not
enabled and ICE in a more useful place if it is.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2010-11-18 Richard Guenther <rguenther@suse.de>
PR lto/45089
* dwarf2out.c (add_AT_die_ref): Work around LTO losing types
when checking is not enabled.
Index: gcc/dwarf2out.c
===================================================================
*** gcc/dwarf2out.c (revision 166900)
--- gcc/dwarf2out.c (working copy)
*************** add_AT_die_ref (dw_die_ref die, enum dwa
*** 7362,7367 ****
--- 7362,7376 ----
{
dw_attr_node attr;
+ #ifdef ENABLE_CHECKING
+ gcc_assert (targ_die != NULL);
+ #else
+ /* With LTO we can end up trying to reference something we didn't create
+ a DIE for. Avoid crashing later on a NULL referenced DIE. */
+ if (targ_die == NULL)
+ return;
+ #endif
+
attr.dw_attr = attr_kind;
attr.dw_attr_val.val_class = dw_val_class_die_ref;
attr.dw_attr_val.v.val_die_ref.die = targ_die;
More information about the Gcc-patches
mailing list