https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121942
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Still invalid. Use -fwrapv otherwise you get undefined behavior due to signed integer overflow. Which you can detect with -fsanitize=undefined: /app/example.cpp:74:42: runtime error: signed integer overflow: 4626885667169763328 - -4596486369685012480 cannot be represented in type 'long int' /app/example.cpp:74:76: runtime error: negation of -9223372036854775808 cannot be represented in type 'long int'; cast to an unsigned type to negate this value to itself There is no ullabs in C++ yet (maybe C++26 will pull in ullabs from C23).