https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81423
--- Comment #16 from Dmitry Babokin <babokin at gmail dot com> --- ll = -5597998501375493990LL; // result is 2595916314 here. ll = unsigned(5677365550390624949L - ll) - (ull1 > 0); So: // t1 is 466811183 unsigned long long int t1 = ll + -2129105131L; // t2 is 10280750143997242019 unsigned long long int t2 = t1 ^ 10280750144413668236ULL; // t3 is 10 unsigned long long int t3 = t2 - 10280750143997242009ULL; So the test case looks correct to me. UBSAN also doesn't complain.