https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96622
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Roland Illig from comment #3) > Ah, thanks for the pointer. > > I thought I had used -O0 in the larger project as well, but I hadn't. > > Just as a suggestion, would it make sense to apply the coverage at the > source code level (before any optimizations) instead of optimizing first and > then adding the counters? It would feel more predictable to me. Note that it's not possible as some optimizations happen in folding even in front-end. Intrumentation happens as soon as possible in optimization pipeline.