From 06140066829cb1fc59222a457d2cdc89deb7d46b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 27 Feb 2019 11:59:07 +0000 Subject: [PATCH] re PR lto/89514 (-g -fdebug-types-section -flto gives 'Dwarf Error: bad length' in gdb) 2019-02-27 Richard Biener PR debug/89514 * dwarf2out.c (size_of_die): Key on AT_ref (a)->comdat_type_p rather than on use_debug_types, doing what output_die does. (value_format): Likewise. From-SVN: r269250 --- gcc/ChangeLog | 7 +++++++ gcc/dwarf2out.c | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 611730062de..831290f88d9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-02-27 Richard Biener + + PR debug/89514 + * dwarf2out.c (size_of_die): Key on AT_ref (a)->comdat_type_p + rather than on use_debug_types, doing what output_die does. + (value_format): Likewise. + 2019-02-27 Martin Jambor Martin Sebor diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index d78e75c914a..5eb5d3a58c3 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -9433,7 +9433,7 @@ size_of_die (dw_die_ref die) we use DW_FORM_ref_addr. In DWARF2, DW_FORM_ref_addr is sized by target address length, whereas in DWARF3 it's always sized as an offset. */ - if (use_debug_types) + if (AT_ref (a)->comdat_type_p) size += DWARF_TYPE_SIGNATURE_SIZE; else if (dwarf_version == 2) size += DWARF2_ADDR_SIZE; @@ -9877,7 +9877,12 @@ value_format (dw_attr_node *a) return DW_FORM_flag; case dw_val_class_die_ref: if (AT_ref_external (a)) - return use_debug_types ? DW_FORM_ref_sig8 : DW_FORM_ref_addr; + { + if (AT_ref (a)->comdat_type_p) + return DW_FORM_ref_sig8; + else + return DW_FORM_ref_addr; + } else return DW_FORM_ref; case dw_val_class_fde_ref: