
Wilco Dijkstra of ARM argues, "Unfortunately unlike other compilers, GCC generates extremely inefficient code with -O0. It is almost unusable for low-level debugging or manual inspection of generated code. So a -O option is always required for compilation. -Og not only allows for fast compilation, but also produces code that is efficient, readable as well as debuggable. Therefore -Og makes for a much better default setting."
The -O0 level doesn't enable any optimizations to reduce compilation time and when debugging allow for expected results. The -Og optimization level is intended for an optimized debugging experience but does enable "a reasonable level of optimization" while balancing the compilation speed and debugging experience. It enables basic performance optimizations and tends to perform better than -O0 in our own C/C++ benchmarks.
GCC's current optimization levels are documented via gcc.gnu.org.
The change is currently sitting on gcc-patches while awaiting feedback from other developers for deciding whether to go ahead and change the default optimization level.
15 Comments