http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51900
--- Comment #5 from Daniel Starke <daniel.f.starke at freenet dot de> 2012-01-19 14:51:33 UTC --- Compiling it with gcc -static -fcommon -o main.o -c main.c gcc -static -fcommon -o a.o -c a.c gcc -static -o main.exe main.o a.o results in $ ./main myVar[0] = 5 myVar[1] = 6 myVar[2] = 7 Compiling it with gcc -static -O2 -fcommon -o main.o -c main.c gcc -static -O2 -fcommon -o a.o -c a.c gcc -static -o main.exe main.o a.o results in $ ./main myVar[0] = 0 myVar[1] = 0 myVar[2] = 0 Thus a different option causes this change.