From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17912 invoked by alias); 21 Feb 2012 21:02:53 -0000 Received: (qmail 17902 invoked by uid 22791); 21 Feb 2012 21:02:52 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Feb 2012 21:02:40 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1LL2eDt021492 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 21 Feb 2012 16:02:40 -0500 Received: from host2.jankratochvil.net (ovpn-116-21.ams2.redhat.com [10.36.116.21]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q1LL2aQX019486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 21 Feb 2012 16:02:38 -0500 Date: Tue, 21 Feb 2012 21:39:00 -0000 From: Jan Kratochvil To: Siddhesh Poyarekar Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Expand bitpos to LONGEST to allow access to large offsets within a struct Message-ID: <20120221210235.GA26897@host2.jankratochvil.net> References: <20120220132724.GB4753@spoyarek.pnq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120220132724.GB4753@spoyarek.pnq.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 X-SW-Source: 2012-02/txt/msg00455.txt.bz2 On Mon, 20 Feb 2012 14:28:24 +0100, Siddhesh Poyarekar wrote: > @@ -1318,13 +1318,13 @@ gen_bitfield_ref (struct expression *exp, struct agent_expr *ax, > > /* The first and one-after-last bits in the field, but rounded down > and up to byte boundaries. */ > - int bound_start = (start / TARGET_CHAR_BIT) * TARGET_CHAR_BIT; > - int bound_end = (((end + TARGET_CHAR_BIT - 1) > + LONGEST bound_start = (start / TARGET_CHAR_BIT) * TARGET_CHAR_BIT; > + LONGEST bound_end = (((end + TARGET_CHAR_BIT - 1) > / TARGET_CHAR_BIT) > * TARGET_CHAR_BIT); In these cases one needs to also reindent the two TARGET_CHAR_BIT lines to properly match their columns. On top of Tom's comments - have you verified you caught all the cases? In these cases I use some typedef struct { LONGEST x; } LONGESTT; which is compatible for assignment only with itself catching all the cases. Unfortunately one needs to adjust by hand all the arithmetic operations just for the purpose of this verification. I guess there exist better static analysis tools for that. Thanks, Jan