https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85759
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |ASSIGNED --- Comment #14 from Martin Liška <marxin at gcc dot gnu.org> --- Got it, it's really happening. Funny how that happens. It's related to a known issue with -fprofile-generate=directory. All *.gcda files are placed directly in the directory, object files subfolder location is ignored. I have a patch draft here: https://gcc.gnu.org/ml/gcc-patches/2017-12/msg01429.html I'll finish it for GCC 9.1. So when ./bash is invoked, it does a fork. When doing a fork, we flush counters and mark that runs count has been already saved. Then a child runs, and it writes alias.gcda for a different TU: marxin@marxinbox:/tmp/bash-4.4.18> find . -name alias.o ./builtins/alias.o ./alias.o And when parent process terminates it attempts to open alias.gcda and realizes it's from a different TU. Thus it's rewritten, but with runs=1 because it was already streamed. Then we see the fishy gcda file. Nice example, thanks for providing a KVM image.