From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CDAAF3857823; Wed, 7 Jul 2021 09:27:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CDAAF3857823 From: "david.marchand at redhat dot com" To: libabigail@sourceware.org Subject: [Bug default/28060] New: [libabigail] Invalid offset for bitfields Date: Wed, 07 Jul 2021 09:27:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: libabigail X-Bugzilla-Component: default X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: david.marchand at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dodji at redhat dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 09:27:56 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28060 Bug ID: 28060 Summary: [libabigail] Invalid offset for bitfields Product: libabigail Version: unspecified Status: NEW Severity: normal Priority: P2 Component: default Assignee: dodji at redhat dot com Reporter: david.marchand at redhat dot com CC: libabigail at sourceware dot org Target Milestone: --- This had been caught by a patchset submitted in the dpdk project. Here is a reproducer with libabigail 1.8.2: $ cat plop.c #include struct bigstruct { char name[128]; #ifdef BEFORE uint8_t bitfield0:1; #else uint8_t bitfield0:1, bitfield1:1; #endif }; void access_bigstruct(struct bigstruct *st) { #ifndef BEFORE st->bitfield1 =3D 1; #endif } $ cat Makefile CC ?=3D gcc CFLAGS ?=3D -Wall -Werror -g ABIDIFF =3D abidiff before_%.o: %.c $(CC) $(CFLAGS) -DBEFORE -o $@ -c $< pahole $@ after_%.o: %.c $(CC) $(CFLAGS) -o $@ -c $< pahole $@ dump: before_plop.o after_plop.o $(ABIDIFF) $^ abidiff before_plop.o after_plop.o $ make Functions changes summary: 0 Removed, 1 Changed, 0 Added function Variables changes summary: 0 Removed, 0 Changed, 0 Added variable 1 function with some indirect sub-type change: [C] 'function void access_bigstruct(bigstruct*)' at plop.c:13:1 has some indirect sub-type changes: parameter 1 of type 'bigstruct*' has sub-type changes: in pointed to type 'struct bigstruct' at plop.c:3:1: type size hasn't changed 1 data member insertion: 'uint8_t bigstruct::bitfield1', at offset 6 (in bits) at plop.c:9= :1 make: *** [dump] Error 4 Afaiu, this offset 6 should instead be 1026. Looking into debug info: $ readelf --debug-dump=3Dinfo after_plop.o |grep -C 10 bitfield1 <2><88>: Abbrev Number: 7 (DW_TAG_member) <89> DW_AT_name : (indirect string, offset: 0x0): bitfield0 <8d> DW_AT_decl_file : 1 <8e> DW_AT_decl_line : 8 <8f> DW_AT_type : <0x49> <93> DW_AT_byte_size : 1 <94> DW_AT_bit_size : 1 <95> DW_AT_bit_offset : 7 <96> DW_AT_data_member_location: 128 <2><97>: Abbrev Number: 7 (DW_TAG_member) <98> DW_AT_name : (indirect string, offset: 0xa): bitfield1 <9c> DW_AT_decl_file : 1 <9d> DW_AT_decl_line : 9 <9e> DW_AT_type : <0x49> DW_AT_byte_size : 1 DW_AT_bit_size : 1 DW_AT_bit_offset : 6 DW_AT_data_member_location: 128 <2>: Abbrev Number: 0 <1>: Abbrev Number: 8 (DW_TAG_array_type) DW_AT_type : <0xbe> --=20 You are receiving this mail because: You are on the CC list for the bug.=