https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96622
--- Comment #3 from Roland Illig <roland.illig at gmx dot de> --- 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. https://gcc.gnu.org/onlinedocs/gcc/Gcov-Intro.html#Gcov-Intro At least for the "discover untested parts of your program", that would make sense to me since in my code, the "break" statement has an effect, independent of any optimization level. https://gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov.html#Invoking-Gcov In this section, the string "tim" occurs often, but only in "number of times", "each time", but not in "measured wall time". Therefore I think gcov is more about counting that about measuring time.