In int versions of adding / subtracting / multiplying overflow checks, GCC returns the int result (good), and long int versions return the long int result (also good), but long long int versions return the long int result (not good). Why is this? It seems crazy to me.
Example:
bool __builtin_uadd_overflow (unsigned int a, unsigned int b, unsigned int *res) bool __builtin_uaddl_overflow (unsigned long int a, unsigned long int b, unsigned long int *res) bool __builtin_uaddll_overflow (unsigned long long int a, unsigned long long int b, unsigned long int *res)
It's so broken, I can't even believe it This means that on targets where long and long long have different sizes (for example, 32-bit ARM iOS targets), versions of the ll functions are completely useless.
source share