[Bug c/64619] No -Wsign-conversion warning

roman.zilka at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Jan 29 09:31:31 GMT 2023


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64619

Roman Žilka <roman.zilka at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roman.zilka at gmail dot com

--- Comment #5 from Roman Žilka <roman.zilka at gmail dot com> ---
I'm looking for a warning that will help find overflows caused by int
promotions changing the signedness from unsigned to signed, e.g.:

uint16_t a, b;
a * b;  // int is 4B, no padding

I assume -Wsign-conversion should cover this, but it isn't triggered. Neither
is -Wconversion. gcc 12.2.1 20230121.

I notice that all of the expressions mentioned previously in this bug are about
signed -> unsigned. The other direction means a warning happening for every use
of a short, char and typedefs thereof in an expression where int promotions
occur. If that's too verbose for -Wsign-conversion, a new -W switch is
appropriate.


More information about the Gcc-bugs mailing list