re PR lto/89514 (-g -fdebug-types-section -flto gives 'Dwarf Error: bad length' in...
authorRichard Biener <rguenther@suse.de>
Wed, 27 Feb 2019 11:59:07 +0000 (11:59 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 27 Feb 2019 11:59:07 +0000 (11:59 +0000)
2019-02-27  Richard Biener  <rguenther@suse.de>

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
gcc/dwarf2out.c

index 611730062ded9c44bc1d085f66eede231ecb67e7..831290f88d9ee2e3580230d796e1e4ce8ca7a29e 100644 (file)
@@ -1,3 +1,10 @@
+2019-02-27  Richard Biener  <rguenther@suse.de>
+
+       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  <mjambor@suse.cz>
            Martin Sebor  <msebor@redhat.com>
 
index d78e75c914afc9bb1e4999606a331111ec9a18ab..5eb5d3a58c31d47263408a1dcffafa3c8cc1738e 100644 (file)
@@ -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: