From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0t92-0007L5-EE for qemu-devel@nongnu.org; Fri, 05 Jun 2015 11:02:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0t8z-0007QK-4e for qemu-devel@nongnu.org; Fri, 05 Jun 2015 11:02:52 -0400 Message-ID: <5571BA13.3040507@redhat.com> Date: Fri, 05 Jun 2015 17:02:43 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1433367941-119488-1-git-send-email-agraf@suse.de> <5571B3BE.60003@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 Cc: Michael Roth , "qemu-ppc@nongnu.org" , Alexander Graf , QEMU Developers On 05/06/2015 16:40, Peter Maydell wrote: > > Speaking in general, I find that this makes code worse. If you're us= ing > > ~0 you probably want the value to extend with infinite ones. > > > > Using ~0u instead of ~0ull may cause problems down the line, and ~0u= l > > is even worse because it is not 64-bit safe. > > I agree that C's semantics are terrible here (ideally > left shift of negative values should Just Work in the 2s > complement style, and right shift of negative values should > be an arithmetic shift). Unfortunately we're stuck with > the standard, which says this is undefined behaviour :-( But this is not something that C compiler writers can reasonably change. Can someone add a checkpatch rule that forbids shifting left U or UL constants (i.e. only ULL)? That would alleviate my concerns with these ubsan warnings. Paolo