On Fri, Aug 2, 2013 at 1:08 PM, Andreas K. Huettel <dilfri...@gentoo.org>wrote:

> I thought -O0 was generally discouraged, even for debugging?!


As Michał said, it all depends on what you want to debug. I would say that
for 90% of issues you *do not* want to use -O0. Your code might not even
compile (libav for instance used to rely heavily in the DCE pass being
executed, GCC disables DCE at -O0), and even if it, you're now given a
different program altogether, so if you're looking for a crash, it might
magically disappear (memory areas get cleared out at -O0 but they might be
re-used without clearing at any other -O level).

But if you're trying to step through an algorithm, an optimized version of
the code will most likely reorder the code that you read from the sources.


Diego Elio Pettenò — Flameeyes
flamee...@flameeyes.eu — http://blog.flameeyes.eu/

Reply via email to