From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyfCX-0001B0-KX for qemu-devel@nongnu.org; Tue, 17 Nov 2015 07:17:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZyfCS-00025l-Hn for qemu-devel@nongnu.org; Tue, 17 Nov 2015 07:17:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyfCS-00025g-Bs for qemu-devel@nongnu.org; Tue, 17 Nov 2015 07:17:28 -0500 References: <1447754381-29882-1-git-send-email-pbonzini@redhat.com> <564B0150.7030400@redhat.com> <564B046F.50205@redhat.com> <87h9kkx2dp.fsf@blackfin.pond.sub.org> From: Laszlo Ersek Message-ID: <564B1AD5.2080009@redhat.com> Date: Tue, 17 Nov 2015 13:17:25 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for 2.5] QEMU does not care about left shifts of signed negative values List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Markus Armbruster Cc: Paolo Bonzini , QEMU Developers On 11/17/15 13:04, Peter Maydell wrote: > On 17 November 2015 at 11:59, Markus Armbruster wrote: >> Laszlo Ersek writes: >> >>> On 11/17/15 11:28, Paolo Bonzini wrote: >>>> >>>> >>>> On 17/11/2015 11:19, Peter Maydell wrote: >>>>> I think we should only take this patch if you can get a cast-iron >>>>> guarantee from both clang and gcc that they will never use this >>>>> UB to drive optimizations. As you say gcc already say this more or >>>>> less, but clang doesn't, and if they're warning about it that to >>>>> me suggests that they will feel freer to rely on the UB in future. >>>> >>>> If and when this happens we will add "-fno-strict-overflow" for clang, >>>> just like we are using "-fno-strict-aliasing" already. >>> >>> How about adding "-fwrapv -fno-strict-overflow" right now? (Spelling out >>> the latter of those explicitly for pointer arithmetic.) >> >> One of them, not both. >> >> Quote gcc manual: >> >> Using -fwrapv means that integer signed overflow is fully defined: >> it wraps. When -fwrapv is used, there is no difference between >> -fstrict-overflow and -fno-strict-overflow for integers. > > I thought this too, but note that it says "for integers". As Laszlo > says, the reason to provide both is to get the -fno-strict-overflow > behaviour for pointer arithmetic, which is not affected by -fwrapv. Correct, that's what I meant. > > thanks > -- PMM >