> debugging is unreliable or impossible with anything other than -O0
My experience is that I can normally get enough information to find a bug from a -O3 stack trace. If I can't, then it's possible to fall back to -O0.
I worry more about the possibilities that (a) some warnings aren't shown if optimisation is off, since apparently the data needed to generate the warning is only computed during an optimisation pass, and (b) some errors might only manifest themselves when optimisation is on, e.g. relying on the value of an uninitialised variable, or strict aliasing issues.
Posted Nov 14, 2011 16:17 UTC (Mon) by epa (subscriber, #39769)
[Link]
You might be interested in kcc which is a full specification of the semantics of the C language, made executable. You can run your code under it and it will warn about undefined or implementation-specific behaviours your code is relying on.