https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78685
--- Comment #29 from rguenther at suse dot de <rguenther at suse dot de> --- On Mon, 28 Apr 2025, Hi-Angel at yandex dot ru wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78685 > > Konstantin Kharlamov <Hi-Angel at yandex dot ru> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |Hi-Angel at yandex dot ru > > --- Comment #28 from Konstantin Kharlamov <Hi-Angel at yandex dot ru> --- > Hi, I understand it's a low-priority issue, but could we at least change the > documentation to say that `-Og` is "supposed to be useful for debugging, but > currently isn't"? I mean, it's a decades old problem, and likely won't be > fixed > in the near future; however the recommendation being present in GCC docs is > harmful, because over and over in different projects someone brings up "why > aren't you using Og instead of O0", wasting I think thousands of man-hours > globally. > > Having docs clarified here would be immensely useful, WDYT? There is still the issue that -O0 does not do variable-tracking which means you get no debug info for the prologue/epilogue - -Og fixes that, at the expense of degraded debugging experience. -Og is supposed to be a blend of optimization which result should be still debuggable (better than -O2). I agree the documentation is misleading, while it may want to spell out the -fvar-tracking issue it fixes, it suggests the debugging experience is better than -O0 which it is not. I'll note that -Og was also mainly motivated by C++ standard library debugging where you end up with quite deep inlining from abstraction penalty which _is_ a bad experience when debugging (and also for runtime performance).