https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105036
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- I think it's expected that you lose some debugging info when optimizing. GCC tries hard to avoid _wrong_ debug info which often results in us dropping things more eagerly. GCC also has the intent to produce the same code with -g and -g0, so disabling some of the optimization, or doing it differently isn't an option.