https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303
--- Comment #4 from mikulas at artax dot karlin.mff.cuni.cz --- ... and another related problem (try this on 32-bit system): #include <stdio.h> #include <stdlib.h> int main(void) { short *a = malloc(0x50000000 * sizeof(short)); short *b = a + 0x50000000; printf("%ld\n", (long)(b - a)); return 0; } Here, the return value should be positive (0x50000000), but it is negative. IMHO, according to the C standard, this is program correct and positive result should be returned. The problem is that it is not easy to fix it without performance penalty and all compilers that I tried (gcc, clang, icc, suncc, opencc, nwcc) print negative result.