From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1eCq-00049i-G6 for qemu-devel@nongnu.org; Wed, 25 Nov 2015 12:50:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1eCm-0008Ed-Eh for qemu-devel@nongnu.org; Wed, 25 Nov 2015 12:50:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1eCm-0008EU-9a for qemu-devel@nongnu.org; Wed, 25 Nov 2015 12:50:08 -0500 References: <1448471956-66873-1-git-send-email-pbonzini@redhat.com> <1448471956-66873-3-git-send-email-pbonzini@redhat.com> From: Paolo Bonzini Message-ID: <5655F4CB.10509@redhat.com> Date: Wed, 25 Nov 2015 18:50:03 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL 2/9] 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 Cc: QEMU Developers On 25/11/2015 18:44, Peter Maydell wrote: > > Ubsan also has warnings for undefined behavior of left shifts. Checks for > > left shift overflow and left shift of negative numbers, unfortunately, > > cannot be silenced without also silencing the useful ones about out-of-range > > shift amounts. -fwrapv ought to shut them up, but doesn't yet > > (https://llvm.org/bugs/show_bug.cgi?id=25552; I am taking care of fixing > > the same issues in GCC). Luckily ubsan is optional, and the easy > > workaround is to use -fsanitize-recover. > > We still haven't had any response from the LLVM/clang folks that > this interpretation of the meaning of -fwrapv is their interpretation > of it, have we? (I can't see any comments on the referenced bug.) Reasonably, they will have to follow what GCC does, independent of -fwrapv. GCC has now promised to not exploit << undefined behavior, even without -fwrapv. So at this point, -fwrapv is only required to placate ubsan---which it will do for GCC as soon as my other patch is approved (I talked on IRC with one of the GCC-ubsan authors and he said he was okay). clang with ubsan remains broken, but that's no worse than before. Paolo