From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHh1z-00072J-31 for qemu-devel@nongnu.org; Tue, 21 Jul 2015 19:33:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHh1u-0004Ck-4I for qemu-devel@nongnu.org; Tue, 21 Jul 2015 19:33:03 -0400 Received: from e18.ny.us.ibm.com ([129.33.205.208]:40080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHh1t-0004Ca-VM for qemu-devel@nongnu.org; Tue, 21 Jul 2015 19:32:58 -0400 Received: from /spool/local by e18.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 21 Jul 2015 19:32:57 -0400 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: References: <1433367941-119488-1-git-send-email-agraf@suse.de> <5571B3BE.60003@redhat.com> <5571BA13.3040507@redhat.com> <5571BE3D.9050002@redhat.com> Message-ID: <20150721233247.23261.2375@loki> Date: Tue, 21 Jul 2015 18:32:47 -0500 Subject: Re: [Qemu-devel] [PULL 00/40] ppc patch queue 2015-06-03 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Paolo Bonzini Cc: "qemu-ppc@nongnu.org" , Alexander Graf , QEMU Developers Quoting Peter Maydell (2015-07-21 06:42:41) > On 5 June 2015 at 16:20, Paolo Bonzini wrote: > > On 05/06/2015 17:08, Peter Maydell wrote: > >>> > Can someone add a checkpatch rule that forbids shifting left U or UL > >>> > constants (i.e. only ULL)? That would alleviate my concerns with t= hese > >>> > ubsan warnings. > >> > >> ...but things like "(1U << 31)" are entirely valid. > > > > They're only valid until someone does a ~ on them. I think it's > > reasonable to forbid them in our coding standards, if we want to fix > > ubsan's warning of (1 << 31). > > > > I don't think it's reasonable for compiler writers to exploit the > > undefinedness of (1 << 31) anyway, and if it were possible to shut up > > ubsan about this particular kind of undefined behavior, I would prefer = it. > = > I just checked, and it isn't possible to suppress this particular > shift warning without also turning off others that we would want > to retain. > = > The ppc code is still provoking this sanitizer warning in my > test runs :-( Was I being silly by not just doing this is the first place? -#define DRC_INDEX_ID_MASK (~(~0 << DRC_INDEX_TYPE_SHIFT)) +#define DRC_INDEX_ID_MASK ((1 << DRC_INDEX_TYPE_SHIFT) - 1) Will send a proper patch to list in a moment. > = > thanks > -- PMM >=20