[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
[Qemu-devel] [PATCH 3/5] Disable warn about left shifts of negative values, Pranith Kumar, 2016/08/09
[Qemu-devel] [PATCH 4/5] clang: Fix warning reg. expansion to 'defined', Pranith Kumar, 2016/08/09
[Qemu-devel] [PATCH 5/5] target-arm: Fix warn about implicit conversion, Pranith Kumar, 2016/08/09
Re: [Qemu-devel] [PATCH 1/5] atomic: strip "const" from variables declared with typeof, Paolo Bonzini, 2016/08/09