http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59753

Vincent Lefèvre <vincent-gcc at vinc17 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|WORKSFORME                  |---
            Summary|Missing -Woverflow warning  |-Woverflow warning
                   |with signed constant        |inconsistency with signed
                   |conversion between T_MAX+1  |constant conversion between
                   |and UT_MAX                  |T_MAX+1 and UT_MAX vs
                   |                            |larger than UT_MAX

--- Comment #4 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
There's still an inconsistency without -Wpedantic, which is the point of this
bug. I've changed the bug title to:

  -Woverflow warning inconsistency with signed constant conversion between
T_MAX+1 and UT_MAX vs larger than UT_MAX

If this inconsistency is intentional, then it should be documented. The current
behavior doesn't match the documentation:

    -Wno-overflow
        Do not warn about compile-time overflow in constant expressions.

I fail to see why there should be a warning for

  short c = 65536;

but not for

  short b = 65535;

BTW, there's actually no overflow in the constant expressions themselves, just
in the assignments.

Reply via email to