[RFC c-common PATCH] PR c++/40752 - useless -Wconversion with short +=.

Jason Merrill jason@redhat.com
Thu Jan 23 17:07:00 GMT 2020


On 1/22/20 5:58 PM, Jason Merrill wrote:
> On 1/22/20 1:20 PM, Jason Merrill wrote:
>> On 1/22/20 5:14 AM, Martin Liška wrote:
>>> Hi.
>>>
>>> Just for the record, after the change 526.blender_r fails due to:
>>>
>>> blender/source/blender/blenlib/intern/math_color.c: In function 
>>> 'rgb_float_to_uchar':
>>> blender/source/blender/blenlib/BLI_utildefines.h:251:22: error: 
>>> conversion from 'float' to 'unsigned char' may change value 
>>> [-Werror=float-conversion]
>>>    251 | #define FTOCHAR(val) ((CHECK_TYPE_INLINE(val, float)), \
>>>        |                      ^
>>> blender/source/blender/blenlib/BLI_utildefines.h:257:13: note: in 
>>> expansion of macro 'FTOCHAR'
>>>    257 |   (v1)[0] = 
>>> FTOCHAR((v2[0]));                                           \
>>>        |             ^~~~~~~
>>> blender/source/blender/blenlib/intern/math_color.c:421:2: note: in 
>>> expansion of macro 'F3TOCHAR3'
>>>    421 |  F3TOCHAR3(col_f, r_col);
>>>        |  ^~~~~~~~~
>>>
>>> where the project sets -Werror=float-conversion dues to:
>>> $ cat blender/source/blender/blenlib/BLI_strict_flags.h
>>>
>>> #ifdef __GNUC__
>>> #  if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406  /* gcc4.6+ only */
>>> #    pragma GCC diagnostic error "-Wsign-compare"
>>> #    pragma GCC diagnostic error "-Wconversion"
>>> #  endif
>>
>> Thanks, investigating.
> 
> I wasn't able to reproduce this particular error, but I saw a different 
> one due to -funsigned-char, fixed thus:

One more tweak, tested powerpc64-linux-gnu.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 93391-2.patch
Type: text/x-patch
Size: 3160 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20200123/34eaf474/attachment.bin>


More information about the Gcc-patches mailing list