- -O2 means easier debugging. This point is really important
because until I realized how true it was, I didn't want to bring this up. Here is a pseudo(but real) disassembly of something I've seen in my dbg = 1 kernel binary while debugging:
... Lots of code
This is how it looks with -O2
... Far less code
I hope we can all agree on which one of these is readable.
For me the most readable is the source form, not the disassembly. Compiling with optimization turned on means the correspondence between source and object forms is often broken, making tracing hard. Local variables are often kept in registers instead of on the stack and are much harder to inspect.
Since I seem to be just about the only one using a source-level debugger (I really cannot understand how the rest of you can live without it, but that's just my opinion <g>) I don't want to block the switch to -O2, but please create an easy way to switch it off.
GvG