diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-01-17 18:42:06 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-01-17 18:42:06 +0100 |
commit | c5b7d7b78fc8e111ce63d944dfc4c45053497fcb (patch) | |
tree | 2dd542d50c7581cfd78916081ec770c623cfd932 /gcc | |
parent | d25fabdc8e1ee25a077aa628432fad6d63b66b8f (diff) | |
download | gcc-c5b7d7b78fc8e111ce63d944dfc4c45053497fcb.zip gcc-c5b7d7b78fc8e111ce63d944dfc4c45053497fcb.tar.gz gcc-c5b7d7b78fc8e111ce63d944dfc4c45053497fcb.tar.bz2 |
re PR debug/71669 (DW_AT_data_bit_offset is not emitted for dwarf4 and above)
PR debug/71669
* dwarf2out.c (add_data_member_location_attribute): For constant
offset bitfield emit for -gdwarf-5 DW_AT_data_bit_offset attribute
instead of DW_AT_data_member_location, DW_AT_bit_offset and
DW_AT_byte_size attributes.
From-SVN: r244542
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 17 |
2 files changed, 25 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d63b83f..25e8f72 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-01-17 Jakub Jelinek <jakub@redhat.com> + + PR debug/71669 + * dwarf2out.c (add_data_member_location_attribute): For constant + offset bitfield emit for -gdwarf-5 DW_AT_data_bit_offset attribute + instead of DW_AT_data_member_location, DW_AT_bit_offset and + DW_AT_byte_size attributes. + 2017-01-17 Eric Botcazou <ebotcazou@adacore.com> * config/rs6000/rs6000.c (rs6000_emit_move): Also use a TOC reference diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index d3b268a..19f7f65 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -18272,6 +18272,23 @@ add_data_member_location_attribute (dw_die_ref die, if (! loc_descr) { + /* While DW_AT_data_bit_offset has been added already in DWARF4, + e.g. GDB only added support to it in November 2016. For DWARF5 + we need newer debug info consumers anyway. We might change this + to dwarf_version >= 4 once most consumers catched up. */ + if (dwarf_version >= 5 + && TREE_CODE (decl) == FIELD_DECL + && DECL_BIT_FIELD_TYPE (decl)) + { + tree off = bit_position (decl); + if (tree_fits_uhwi_p (off) && get_AT (die, DW_AT_bit_size)) + { + remove_AT (die, DW_AT_byte_size); + remove_AT (die, DW_AT_bit_offset); + add_AT_unsigned (die, DW_AT_data_bit_offset, tree_to_uhwi (off)); + return; + } + } if (dwarf_version > 2) { /* Don't need to output a location expression, just the constant. */ |