From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51057 invoked by alias); 29 Apr 2019 18:57:03 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 51017 invoked by uid 89); 29 Apr 2019 18:57:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 29 Apr 2019 18:57:01 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 7C52E11719B; Mon, 29 Apr 2019 14:57:00 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id yJj35R9qWfhF; Mon, 29 Apr 2019 14:57:00 -0400 (EDT) Received: from murgatroyd (97-122-168-123.hlrn.qwest.net [97.122.168.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 04E04117192; Mon, 29 Apr 2019 14:56:59 -0400 (EDT) From: Tom Tromey To: Eli Zaretskii Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] Change ptype/o to print bit offset References: <20190429183105.15973-1-tromey@adacore.com> <20190429183105.15973-3-tromey@adacore.com> <83zho8skya.fsf@gnu.org> Date: Mon, 29 Apr 2019 18:57:00 -0000 In-Reply-To: <83zho8skya.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 29 Apr 2019 21:52:29 +0300") Message-ID: <87ftq04p38.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-04/txt/msg00634.txt.bz2 >>>>> "Eli" == Eli Zaretskii writes: >> /* 5: 0 | 4 */ unsigned int y : 3; >> /* 5: 3 | 4 */ unsigned int z : 3; >> /* XXX 2-bit padding */ >> /* XXX 3-byte padding */ Eli> This loses information, because now the bits part is just a trivial Eli> conversion of the field size in the declaration. The current display Eli> shows something that cannot be trivially gleaned by looking at the Eli> bitfield sizes. Eli> I'm not objecting to the change, I'm just saying we lose something Eli> here. We don't actually lose anything here, because the padding is spelled out explicitly in the comments that are printed. Also, consider an example like this, from an Ada test case: /* offset | size */ type = struct aggregates__nested_packed { /* 0: 5 | 1 */ q000 : 3; /* 0:23 | 8 */ struct aggregates__packed_rec { /* 0 | 4 */ integer packed_array_assign_w; /* 4: 5 | 1 */ packed_array_assign_x : 3; /* 4: 2 | 1 */ packed_array_assign_y : 3; /* XXX 2-bit padding */ /* XXX 3-byte padding */ /* total size (bytes): 8 */ } r000 : 38; The "0:23" here is, IMO, actively confusing. Tom