Forgive me if this is reported/fixed already; after many consecutive hours of debugging I currently do not have the courage to search through the list of bugs.
Please, try this code (tested on 32bit GNU/Linux), compiled with: gcc -std=c99 -Wall -Wextra -o wtf wtf.c #include <stdio.h> int main(void) { int n1, n2; long long n3, n4; n1 = -0x80000000; n2 = -2147483648; n3 = -0x80000000; n4 = -2147483648; printf("n1 = %d\n", n1); printf("n2 = %d\n", n2); printf("n3 = %lld\n", n3); printf("n4 = %lld\n", n4); return 0; } It consists of two int variables and two long long variables, all of them set to the same value (-2147483648 == 0x80000000). This is what I get: n1 = -2147483648 n2 = -2147483648 n3 = 2147483648 n4 = -2147483648 What happened to n3? It appears that hex constants are not promoted to long long the same way as decimal ones. AFAIK, this behavoir does not match C99 (neither C90). When compiling without -std=c99, gcc gives this warning: warning: this decimal constant is unsigned only in ISO C90 I think that gcc is trying to say that the constant does not fit on an int (nor a long) and it is promoted to unsigned, as it is stated by ISO C90. But yes, it should fit on an int, because -2147483648 >= INT_MIN in this architecture. Anyway, it is even more funny, because the warning is only for n2 and n4 (decimal constants) but not for n1 nor n4 (hex constants). This is the output without -std=c99: n1 = -2147483648 n2 = -2147483648 n3 = 2147483648 n4 = 2147483648 Tested with these versions of gcc: Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with-tune=i686 --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --with-tune=pentium4 --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5) -- Summary: Integer hex constant does not follow promoting rules Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: roberto dot gordo at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31166