https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95348
--- Comment #36 from qinzhao at gcc dot gnu.org --- I found a bug with this proposed patch: when doing automatic merging, the following error message is emitted: Merge mismatch for function 1. the bug can be repeated with the small testing case I added in the comment #1 and the following script: #!/bin/bash GCC=/GCC-install-dir/bin/gcc opt="-O0 " opt="$opt -fno-inline" opt_gen="-fprofile-generate" opt_gen="$opt_gen -fprofile-dir=gcc_prof_dir" tf1="five.c" tf2="ten.c" libf="lib.c" rm -rf gcc_prof_dir echo $GCC $opt $opt_gen -c $libf $GCC $opt $opt_gen -c $libf -o lib.o echo $GCC $opt $opt_gen $tf1 $GCC $opt $opt_gen -c $tf1 -o five.o echo $GCC $opt $opt_gen $tf2 $GCC $opt $opt_gen -c $tf2 -o ten.o echo $GCC $opt $opt_gen ten.o five.o lib.o -o ten $GCC $opt $opt_gen ten.o five.o lib.o -o ten ./ten 12 ./ten 11 echo "Done" [qinzhao@localhost small_gcc]$ sh build_it_gcc /home/qinzhao/Install/latest-821/bin/gcc -O0 -fno-inline -fprofile-generate -fprofile-dir=gcc_prof_dir -c lib.c /home/qinzhao/Install/latest-821/bin/gcc -O0 -fno-inline -fprofile-generate -fprofile-dir=gcc_prof_dir five.c /home/qinzhao/Install/latest-821/bin/gcc -O0 -fno-inline -fprofile-generate -fprofile-dir=gcc_prof_dir ten.c /home/qinzhao/Install/latest-821/bin/gcc -O0 -fno-inline -fprofile-generate -fprofile-dir=gcc_prof_dir ten.o five.o lib.o -o ten 12 is greater than ten 11 is greater than ten profiling:gcc_prof_dir/#home#qinzhao#Bugs#profile#small_gcc#lib.gcda:Merge mismatch for function 1 profiling:gcc_prof_dir/#home#qinzhao#Bugs#profile#small_gcc#five.gcda:Merge mismatch for function 0 Done