https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83703
--- Comment #1 from Mikael Pettersson <mikpelinux at gmail dot com> --- There's a signed int overflow in this code, leading to UB. Compile and run with -fsanitize=undefined and you'll get reg.cpp:49:23: runtime error: signed integer overflow: -359 * 5999999 cannot be represented in type 'int' Eliminate that and it should work.