I noticed that my code broke at -O3, but not at -O2. I tried applying the flags one by one, and I found that
gcc -O1 -finline-functions code.c
breaks; and
gcc -O1 -fno-inline-functions code.c
works.
By "breaks," I mean that it compiles, but it runs incorrectly.
Where should I look for this bug? I can post code, but as it weighs in at 1.5k SLOC, I'd rather not post the whole thing.
Versions:
$ uname -a
Linux xxxx.xxxx 2.6.18-308.20.1.el5 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)