Most build environments I've seen have at least two strategies: debug build vs final/optimized/release build. With gcc, this usually means some version of -g
vs -O
. Now I'm seeing a situation where the optimized build is built with -O3
while the debug version is built with -g3
and-O3
. man gcc
does indicate that is possible, but this seems counterintuitive to me for real debugging purposes.
Reviewing http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html reminded me of -Og
, which allows optimizations that do not interfere with debugging. That makes sense to me, but what compelling reason is there to debug with -O3 -g3
unless you are basically trying to debug gcc's own optimization abilities?