https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111243
--- Comment #12 from rguenther at suse dot de <rguenther at suse dot de> --- On Fri, 1 Sep 2023, amohr at amohr dot org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111243 > > --- Comment #10 from Alex Mohr <amohr at amohr dot org> --- > (In reply to Xi Ruoyao from comment #9) > > I believe the only real issue is imprecise documentation: "It is a better > > choice than -O0" has some caveats and it's not always true. > > Is there a way to explicitly enable the compiler passes that collect debug > info > that are disabled at -O0? The main missing pass can be enabled with -fvar-tracking, at -O0 we miss debug info for the prologue/epilogue of functions. IIRC the pass is disabled at -O0 because at -O0 we have many more memory references and var-tracking becomes slow and memory hungry (YMMV). With -Og automatic variables are no longer necessarily memory backed so the situation is avoided to some extent.