https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107465
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.5
Known to work| |4.1.2
Summary|Bogus warning: promoted |[10/11/12/13 Regression]
|bitwise complement of an |Bogus warning: promoted
|unsigned value is always |bitwise complement of an
|nonzero |unsigned value is always
| |nonzero
Ever confirmed|0 |1
Known to fail| |4.4.7, 4.8.1
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=8715
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-10-31
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>Also, it's weird that the warning is only issued with a typedef for the type
>of "x".
My bet there is some IR difference (inside GCC) which is causing an extra
NOP_EXPR (a cast) being added due to the typedef and "unsigned short" are not
represented the same internally for diagnostic reasons.
Confirmed.
r0-88988-g2d12797c692346 (PR 8715) introduced the warning in GCC 4.4.0 which
seems to point to that is what is causing the bogus warning to show up.