From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZymKm-00078q-3b for qemu-devel@nongnu.org; Tue, 17 Nov 2015 14:54:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZymKh-0006eW-9f for qemu-devel@nongnu.org; Tue, 17 Nov 2015 14:54:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59732) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZymKh-0006eQ-3q for qemu-devel@nongnu.org; Tue, 17 Nov 2015 14:54:27 -0500 References: <1447769349-1767-1-git-send-email-pbonzini@redhat.com> <874mgkh6f5.fsf@blackfin.pond.sub.org> <564B67BE.5040001@redhat.com> <564B702E.4070806@redhat.com> <871tbobh8t.fsf@blackfin.pond.sub.org> From: Paolo Bonzini Message-ID: <564B85EE.30501@redhat.com> Date: Tue, 17 Nov 2015 20:54:22 +0100 MIME-Version: 1.0 In-Reply-To: <871tbobh8t.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=windows-1252 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: Markus Armbruster , Peter Maydell Cc: Laszlo Ersek , QEMU Developers On 17/11/2015 19:41, Markus Armbruster wrote: > Peter Maydell writes: > >> 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. > > A warning doesn't necessarily mean "this isn't well-defined". It could > also mean "this might not be portable", or "we think your code is ugly". > Inferring semantics from warnings is shaky business. Instead, let's ask > the maintainers of gcc to clarify the meaning of -fwrapv. But again, we're not getting any warning in the first place. Paolo