https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84548
--- Comment #14 from Martin Liška <marxin at gcc dot gnu.org> --- Created attachment 43508 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43508&action=edit Patch candidate For reduced test-case: $ cat test.cc struct A { static int foo () { return 1; }; static int bar () { int x; return 2; } }; int main() { return A::foo () + A::bar (); } I now have: $ cat test.cc.gcov -: 0:Source:test.cc -: 0:Graph:test.gcno -: 0:Data:test.gcda -: 0:Runs:1 -: 0:Programs:1 2: 1:struct A { static int foo () { return 1; }; static int bar () { -: 2: int x; 1: 3: return 2; } }; ------------------ _ZN1A3fooEv: 1: 1:struct A { static int foo () { return 1; }; static int bar () { ------------------ _ZN1A3barEv: 1: 1:struct A { static int foo () { return 1; }; static int bar () { -: 2: int x; 1: 3: return 2; } }; ------------------ -: 4: 1: 5:int main() -: 6:{ 1: 7: return A::foo () + A::bar (); -: 8:} Which is correct in my opinion. Can you please Dmitry test the patch?