From patchwork Thu Jul 8 09:34:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dodji at seketeli dot org X-Patchwork-Id: 44215 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1A48C398545C for ; Thu, 8 Jul 2021 09:34:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A48C398545C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1625736863; bh=AsxkUfDCGyTfYUvpX69W6sOOUj13wZPAcQkIgEnxubg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=TLuMZ46lxulQKJy9juagYyO/MZMOBI46Vgg5BslRO0KU+S/WYICNGnw0yP+LqPAoq NLlGTmqcvH4Hrua3ixTsmwlwoXBZBQsljlnjaTqOkTsADKr3Jf+ld2FX9NWcmY3/KF IO+rxWrT0JId5kB9Gom6g+yT3BJ6RjPPaoIuTpRM= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: by sourceware.org (Postfix, from userid 48) id 60FBF3982422; Thu, 8 Jul 2021 09:34:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 60FBF3982422 To: libabigail@sourceware.org Subject: [Bug default/28060] [libabigail] Invalid offset for bitfields Date: Thu, 08 Jul 2021 09:34:20 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: gprocida at google 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: cc Message-ID: In-Reply-To: References: 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-Patchwork-Original-From: gprocida at google dot com via Libabigail From: dodji at seketeli dot org Reply-To: gprocida at google dot com Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" https://sourceware.org/bugzilla/show_bug.cgi?id=28060 gprocida at google dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gprocida at google dot com --- Comment #2 from gprocida at google dot com --- The problem is in abidw, not abidiff. I'm guessing that both DW_AT_data_member_location and DW_AT_data_bit_offset need to be taken into consideration, not just one of them. The problem exists with -gdwarf-3 and -gdwarf-4, but not -gdwarf-5. $ head test.{0,1}.c ==> test.0.c <== #include struct bigstruct { char name[128]; uint8_t bitfield0:1; }; uint8_t foo(const struct bigstruct * big) { return big->bitfield0; } ==> test.1.c <== #include struct bigstruct { char name[128]; uint8_t bitfield0:1; uint8_t bitfield1:1; }; uint8_t foo(const struct bigstruct * big) { return big->bitfield0; } $ for i in 0 1; do gcc -Wall -Wextra -g -c test.$i.c; abidw --no-show-locs test.$i.o > test.$i.xml; done $ diff -u test.{0,1}.xml comp-dir-path='/usr/local/google/home/gprocida/dev/libabigail/bitfields2' language='LANG_C99'> @@ -18,6 +18,9 @@ + + + --- test.0.xml 2021-07-08 10:21:30.460919575 +0100 +++ test.1.xml 2021-07-08 10:21:30.516919874 +0100 @@ -1,8 +1,8 @@ - + - +