All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Markus Armbruster <armbru@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH for 2.5] QEMU does not care about left shifts of signed negative values
Date: Tue, 17 Nov 2015 11:36:29 +0100	[thread overview]
Message-ID: <564B032D.1030103@redhat.com> (raw)
In-Reply-To: <878u5wzzuu.fsf@blackfin.pond.sub.org>

On 11/17/15 11:26, Markus Armbruster wrote:
> Paolo Bonzini <pbonzini@redhat.com> writes:
> 
>> There's no reason for the compiler to exploit the undefinedness of left
>> shifts, In fact GCC explicitly documents that they do not use at all
>> all this possibility.  They also say this is subject to change, but
> 
> Suggest to scratch one of two "all" :)
> 
>> they have been saying this for 10 years (since the wording appeared in
>> the GCC 4.0 manual).
>>
>> Any workaround for this particular case of undefined behavior uglifies
>> the code: using unsigned is unsafe because the value becomes positive
>> when extended; using -(a << b) does not express as well that the
>> intention is to compute -a * 2^N.
>>
>> Clang has just added an obnoxious, pointless, *totally useless*, unsafe
>> warning about this.  It's obnoxious and pointless because the compiler
>> is not using the latitude that the standard gives it, so it just adds
>> noise.  It is useless and unsafe because it does not catch the widely
>> more common case where the LHS is a variable, and thus gives a false

"wildly more", I think.

>> sense of security.
>>
>> The noisy nature of the warning means that it should have never been
>> added to -Wall.  The uselessness means that it probably should not
>> have even been added to -Wextra.
>>
>> Document this explicitly, and shut up the stupid warning.
>> </rant>
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
> 

      reply	other threads:[~2015-11-17 10:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17  9:59 [Qemu-devel] [PATCH for 2.5] QEMU does not care about left shifts of signed negative values Paolo Bonzini
2015-11-17 10:19 ` Peter Maydell
2015-11-17 10:28   ` Paolo Bonzini
2015-11-17 10:36     ` Peter Maydell
2015-11-17 10:37       ` Paolo Bonzini
2015-11-17 10:42         ` Peter Maydell
2015-11-17 10:55         ` Peter Maydell
2015-11-17 10:57           ` Paolo Bonzini
2015-11-17 11:22             ` Peter Maydell
2015-11-17 12:10               ` Paolo Bonzini
2015-11-17 12:22                 ` Peter Maydell
2015-11-17 10:41     ` Laszlo Ersek
2015-11-17 10:43       ` Paolo Bonzini
2015-11-17 10:52         ` Laszlo Ersek
2015-11-17 11:59       ` Markus Armbruster
2015-11-17 12:04         ` Peter Maydell
2015-11-17 12:17           ` Laszlo Ersek
2015-11-17 13:48           ` Paolo Bonzini
2015-11-17 12:18         ` Laszlo Ersek
2015-11-17 10:26 ` Markus Armbruster
2015-11-17 10:36   ` Laszlo Ersek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=564B032D.1030103@redhat.com \
    --to=lersek@redhat.com \
    --cc=armbru@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.