[Bug debug/78685] -Og generates too many "<optimized out>"s (it should generate artificial uses for variables at end of scope to avoid this)
rsandifo at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 11 11:27:12 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78685
--- Comment #36 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
Regarding the subject change to add "it should generate artificial uses for
variables at end of scope to avoid this": I'm not sure that that's a panacea.
It would keep live the subset of assigned values that can reach the end of the
scope, and so would be better than the status quo, but it wouldn't help with
other assignments.
Also, keeping the value live at the end of the scope guarantees that the
executable code can calculate the value at that particular point in the
program. It doesn't (IIUC) guarantee that a debugger can calculate the correct
value at all intermediate points, even with var-tracking. It's more about
increasing the chances.
More information about the Gcc-bugs
mailing list