https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98151
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Host|Linux | |5.8.15-301.fc33.x86_64 | Status|UNCONFIRMED |WAITING Last reconfirmed| |2020-12-05 Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I think you have an signed integer overflow happening. Take a look at: 10 * result + s[index++] - '0' To avoid the overflow, do instead: 10 * result + (s[index++] - '0')