https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120938
--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> --- Even smaller set of example. Bad profile: #include <stdio.h> volatile int variablev; static void inc() { variablev++; } static int zero = 0; int main () { for (int i = 0; i < 100000000; i++) { inc();inc(); inc();inc(); } return 0; } good profile: #include <stdio.h> volatile int variablev; static void inc() { variablev++; } static int zero = 0; int main () { for (int i = 0; i < 100000000; i++) { inc();inc(); inc(); inc(); } return 0; } Only difference is the fourth invocation of inc(). I checked that the problem also reproduces with llvm's profile generator. If the file is built with clang profiles are OK. Diff of dwarf2 debug is not that small, I will attach it.