qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/5] softfloat: Fix warn about implicit conversi


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 2/5] softfloat: Fix warn about implicit conversion from int to int8_t
Date: Wed, 10 Aug 2016 11:37:32 +0100

On 10 August 2016 at 11:32, Richard Henderson <address@hidden> wrote:
> On 08/10/2016 12:32 AM, Pranith Kumar wrote:
>>
>>  typedef struct float_status {
>> +    int         float_exception_flags;
>>      signed char float_detect_tininess;
>>      signed char float_rounding_mode;
>> -    signed char float_exception_flags;
>
>
> Given that there are no flags outside 8 bits, why is this supposed to help?

It's just consistency -- using the same type all the way through
from the set_float_exception_flags() prototype to the field
in the structure. When we were discussing this on IRC that
seemed a reasonable approach to me.

What clang is specifically warning about is if you pass
float_flag_output_denormal to set_float_exception_flags():
that's a positive number (128), which gets implicitly
converted to a negative number when it's assigned to
the signed char. Using a type wide enough to store
128 all the way through fixes this. (Unsigned char would
work too.)

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]