https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78685
--- Comment #5 from Paul Eggert <eggert at gnu dot org> --- Just to clarify: 'main' (in the sample program) is just an example. The problems developers are seeing when debugging Emacs almost all involve functions other than 'main'. It should be OK for -Og to optimize significantly less than it does now, so long as -Og remains better than -O0. As things stand, -Og is pretty much useless for its stated purpose because GDB so often cannot display values of locals, and I expect this partly explains why -Og is so rarely used in practice. In Emacs, developers use -O0 for debugging, but this can be reeeaally slow because -O0 does not inline and Emacs relies heavily on small inlined functions. Although Emacs works around this problem by using macros instead of functions, such workarounds have obvious drawbacks. For Emacs, it would be nice if -Og did not discard locals, but continued to inline.