From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwE1w-0000Dr-Ml for qemu-devel@nongnu.org; Tue, 10 Nov 2015 13:52:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwE1s-0005q9-Ji for qemu-devel@nongnu.org; Tue, 10 Nov 2015 13:52:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47207) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwE1s-0005q5-E6 for qemu-devel@nongnu.org; Tue, 10 Nov 2015 13:52:28 -0500 From: Markus Armbruster References: <1447171055-29567-1-git-send-email-stefanha@redhat.com> <1447171055-29567-4-git-send-email-stefanha@redhat.com> <56422A70.8040306@redhat.com> Date: Tue, 10 Nov 2015 19:52:25 +0100 In-Reply-To: (Peter Maydell's message of "Tue, 10 Nov 2015 17:48:18 +0000") Message-ID: <87vb99lmae.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 3/3] disas/arm: avoid clang shifting negative signed warning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , QEMU Developers , Stefan Hajnoczi , Eduardo Habkost Peter Maydell writes: > On 10 November 2015 at 17:33, Paolo Bonzini wrote: >> >> >> On 10/11/2015 16:57, Stefan Hajnoczi wrote: >>> clang 3.7.0 on x86_64 warns about the following: >>> >>> disas/arm.c:1782:17: warning: shifting a negative signed value is undefined [-Wshift-negative-value] >>> imm |= (-1 << 7); >>> ~~ ^ >>> >>> Note that this patch preserves the tab indent in this source file >>> because the surrounding code still uses tabs. >>> >>> Signed-off-by: Stefan Hajnoczi >> >> I would like to know a case where (except with ubsan) clang actually >> uses the optimization. >> >> If not, this is just error message theatre (which is not news for clang) >> and shouldn't have been part of -Wall. > > It could be they're attempting to warn us now about the possibility > that in a future version of clang they will start using this UB > to optimize with. > > http://stackoverflow.com/questions/22883790/left-shift-of-negative-values > reports that Intel's ICC will use this in dead-code-elimination > optimization. One day clang might do that too. Nice example of a compiler being gratuitously nasty.