[Bug c/104711] Unnecessary -Wshift-negative-value warning
segher at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Feb 27 22:37:08 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104711
Segher Boessenkool <segher at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-02-27
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #2 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Our documentation says in
<https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html>
As an extension to the C language, GCC does not use the latitude given in C99
and C11 only to treat certain aspects of signed ‘<<’ as undefined. However,
-fsanitize=shift (and -fsanitize=undefined) will diagnose such cases. They
are
also diagnosed where constant expressions are required.
It would be much saner / much more practical if we actually implemented this,
i.e. don't have -Wshift-negative-value in -Wextra (the above text does not make
much sense if that was the design!)
This warning does have a good enough balance between amount of false positives,
detection of serious problems, and usefulness to be included in -Wextra. The
considerations for -Wall and -W are exactly the same, just the bar is lower for
the latter.
Confirmed.
More information about the Gcc-bugs
mailing list