https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105238
--- Comment #7 from Esger Abbink <esgergn at hotmail dot com> --- Building a real project with the patched gcc9.4 and ccache 4.5.1 (replacing -fprofile-dir with -fprofile-prefix-map=${CMAKE_SOURCE_DIR}=.) it looks ok at first sight: - 100% cache hits for the second compilation in a different directory - gcda created next to .o & .gcda for both first and second compilations/directories However when running the unittests binaries there are quite a number of gcov warnings: [==========] 2807 tests from 297 test suites ran. (272928 ms total) [ PASSED ] 2807 tests. libgcov profiling error: :overwriting an existing profile data with a different timestamp libgcov profiling error:#:overwriting an existing profile data with a different timestamp libgcov profiling error: :overwriting an existing profile data with a different timestamp libgcov profiling error::overwriting an existing profile data with a different timestamp libgcov profiling error::overwriting an existing profile data with a different timestamp libgcov profiling error:#:overwriting an existing profile data with a different timestamp libgcov profiling error:&:overwriting an existing profile data with a different timestamp libgcov profiling error:#:overwriting an existing profile data with a different timestamp libgcov profiling error:#:overwriting an existing profile data with a different timestamp libgcov profiling error:':overwriting an existing profile data with a different timestamp profiling::Cannot open libgcov profiling error:#:overwriting an existing profile data with a different timestamp libgcov profiling error:#:overwriting an existing profile data with a different timestamp libgcov profiling error::overwriting an existing profile data with a different timestamp ... [this continues for quite a number of lines] Note that these warnings are produced both for the directory where compilation really took place as for the directory where .o & .gcno were taken from the cache. Since the gcda files are created next to the .o * .gcno there should not be any name clashes (for identical names the path would still be different). So I am not sure what is happening here? Unfortunately, the warning lines do not include any information about which file is being written or which file is clashing. Still, gcovr is able to produce a coverage report with information that looks sane, but there are differences with the gcc7.5 reports. I would assume because of the above warnings. The coverage report for the second compilation (using cached .o & .gcno) is for all intents and purposes the same as the one for the first compilation. The difference being 2 lines and 2 branches on totals of 17515 and 14727.