[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values |
Date: |
Tue, 17 Nov 2015 20:54:22 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 17/11/2015 19:41, Markus Armbruster wrote:
> Peter Maydell <address@hidden> writes:
>
>> On 17 November 2015 at 18:21, Paolo Bonzini <address@hidden> 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
- Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values, (continued)
- Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values, Markus Armbruster, 2015/11/17
- Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values, Paolo Bonzini, 2015/11/17
- Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values, Peter Maydell, 2015/11/17
- Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values, Paolo Bonzini, 2015/11/17
- Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values, Peter Maydell, 2015/11/17
- Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values, Paolo Bonzini, 2015/11/17
- Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values, Peter Maydell, 2015/11/17
- Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values, Markus Armbruster, 2015/11/17
- Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values, Markus Armbruster, 2015/11/17