From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyl7f-0002Dv-9k for qemu-devel@nongnu.org; Tue, 17 Nov 2015 13:36:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zyl7a-0004TR-VN for qemu-devel@nongnu.org; Tue, 17 Nov 2015 13:36:55 -0500 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:34282) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyl7a-0004TN-PT for qemu-devel@nongnu.org; Tue, 17 Nov 2015 13:36:50 -0500 Received: by wmvv187 with SMTP id v187so242276592wmv.1 for ; Tue, 17 Nov 2015 10:36:50 -0800 (PST) Sender: Paolo Bonzini References: <1447769349-1767-1-git-send-email-pbonzini@redhat.com> <874mgkh6f5.fsf@blackfin.pond.sub.org> <564B67BE.5040001@redhat.com> <564B702E.4070806@redhat.com> From: Paolo Bonzini Message-ID: <564B73BF.1080800@redhat.com> Date: Tue, 17 Nov 2015 19:36:47 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 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 Cc: Laszlo Ersek , Markus Armbruster , QEMU Developers On 17/11/2015 19:24, Peter Maydell wrote: > On 17 November 2015 at 18:21, Paolo Bonzini wrote: >> >> >> On 17/11/2015 19:19, Peter Maydell wrote: >>> That doesn't seem like more than half-good news to me. In particular, >>> if ubsan is still diagnosing these cases and they're still a >>> problem in some constant expressions >> >> Constant expressions are standardese for e.g. >> >> static int x = 1 << 31; >> >> It doesn't mean _all_ constants, and the warning only triggers with >> -pedantic. > > But if "-fwrapv" means "this dialect of C makes shifts of > negative numbers well defined and OK" then "-1 << 31" > should be fine and should not provoke a warning (whether in > a constant expression or not). If that's not what -fwrapv means, > then we shouldn't be using it as if it did. Since we don't use -pedantic, we don't care. But I agree that it could be the subject of a separate fix. For now I'll focus on ubsan since that's the more important one. Paolo