https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111394
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Adding:
if (n < 0)
exit(1);
Or:
if (n < 0)
__builtin_unreachable();
Fixes the warning.
Yes the warning could be slightly better but it is definitely a bug in your
code if you are not checking the input ...