[Bug debug/78839] [6/7 Regression] DWARF output different between GCC 5 and 6
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78839 --- Comment #10 from Tom O'Connor --- In regards to GDB, I noticed that when using a macro to get the offset for these bitfields, with objects built by both GCC 5 and earlier as well as GCC 6, I always get 0. For example: (gdb) macro define offsetof(t, f) &((t *) 0)->f) (gdb) p offsetof(struct s, type) $1 = (unsigned int *) 0x0 Historically, prior to GCC 6, this always matched up with DWARF's DW_AT_data_member_location value for bitfields. Yes, I see how GCC 6's combination of data_member_location and bit_offset can be combined to reach the true location. Historically, my use case has used the data_member_location value to get me the offset into say a raw memory image, for where to start reading data from a field of a structure in memory; I'd do bitfield shifts after reading from the aligned offset as reported in the DWARF structure. If using DECL_BIT_FIELD_REPRESENTATIVE as data_member_location is nicer and doesn't break the Ada use case, I'd be all for that. But if what's currently being emitted by GCC 6 is considered "more correct" than what previous versions had emitted, then I'll have to adjust. I only noticed the change between 5 and 6 once I started seeing odd results with the same code built by different GCCs.
[Bug other/78839] DWARF output different between GCC 5 and 6
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78839 --- Comment #6 from Tom O'Connor --- (In reply to Andrew Pinski from comment #5) > (In reply to Tom O'Connor from comment #4) > > Bitfields seemed to work fine in all GCC prior to 6, FWIW. The same > > attached source code when built with other GCCs prior to 6 generates > > DW_AT_data_member_location = 0 for all the fields as expected. Only 6 gets > > some of the fields "wrong". > > Maybe I am thinking big-endian :). Ah, I've only observed this on little-endian, as that's the only place I've looked.
[Bug other/78839] DWARF output different between GCC 5 and 6
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78839 --- Comment #4 from Tom O'Connor --- Bitfields seemed to work fine in all GCC prior to 6, FWIW. The same attached source code when built with other GCCs prior to 6 generates DW_AT_data_member_location = 0 for all the fields as expected. Only 6 gets some of the fields "wrong".
[Bug other/78839] DWARF output different between GCC 5 and 6
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78839 --- Comment #2 from Tom O'Connor --- Created attachment 40355 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40355=edit debuginfo from a GCC 6.1.0 build of s.c
[Bug other/78839] DWARF output different between GCC 5 and 6
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78839 --- Comment #1 from Tom O'Connor --- Created attachment 40354 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40354=edit debuginfo from a GCC 5.4.0 build of s.c
[Bug other/78839] New: DWARF output different between GCC 5 and 6
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78839 Bug ID: 78839 Summary: DWARF output different between GCC 5 and 6 Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: toconnor at forcepoint dot com Target Milestone: --- Created attachment 40353 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40353=edit sample c code I've observed a difference in DWARF output for the same input source code between GCC 5 and GCC 6, specifically in the DW_AT_data_member_location values for bitfield members of structs. For example, s.c: struct s { unsigned int shutdown:2, no_check_tx:1, no_check_rx:1, userlocks:4, protocol:8, type:16; }; int main() { struct s s; return 0; } GCC 5 reports DW_AT_data_member_location for all the fields as 0, which is expected. GCC 6 reports DW_AT_data_member_location for the "type" and "protocol" fields as 2 and 1 respectively, all other fields 0 as expected. The DW_AT_bt_offset fields for "type" and "protocol" change as well. According to a mailing list posting, this is related to this change: http://gcc.gnu.org/r231762