Pekka Paalanen writes:
> [ Unknown signature status ]
> On Fri, 1 Sep 2017 11:55:15 -0700
> Eric Anholt wrote:
>
>> ---
>>
>> Pekka - that link didn't help, because we still need a correct
>> "result" value. I don't believe that the compiler could break
On Fri, 1 Sep 2017 11:55:15 -0700
Eric Anholt wrote:
> ---
>
> Pekka - that link didn't help, because we still need a correct
> "result" value. I don't believe that the compiler could break uint ->
> int conversions with the high bit, but here's the patch I think we
> would
---
Pekka - that link didn't help, because we still need a correct
"result" value. I don't believe that the compiler could break uint ->
int conversions with the high bit, but here's the patch I think we
would need for that. I still think v1 is the better version.
include/misc.h | 21
On Thu, 24 Aug 2017 18:21:15 -0700
"Keith Packard" wrote:
> Michel Dänzer writes:
>
> > Is assigning an unsigned value with the MSB set to a signed variable
> > well-defined in C?
>
> I have no idea. And I just spent a few hours wading through the
Michel Dänzer writes:
> Is assigning an unsigned value with the MSB set to a signed variable
> well-defined in C?
I have no idea. And I just spent a few hours wading through the N1570
draft of the C standard on a related issue. In particular, this is
worrying:
6.3.1.3
3
On 25/08/17 03:57 AM, Eric Anholt wrote:
> ---
>
> We pass the overflow unit tests both before and after this change, but
> this should be safer.
>
> include/misc.h | 8 ++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/include/misc.h b/include/misc.h
> index
Eric Anholt writes:
> ---
>
> We pass the overflow unit tests both before and after this change, but
> this should be safer.
I've seen GCC do precisely the 'optimization' you are concerned about,
but only when one of the operands is constant. One should use -fwrapv
whenever
---
We pass the overflow unit tests both before and after this change, but
this should be safer.
include/misc.h | 8 ++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/misc.h b/include/misc.h
index 0feeaebc7c1a..9d0e422e36b4 100644
--- a/include/misc.h
+++