https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90364
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Martin Liška from comment #10) > All right, I understand what goes wrong. The benchmark builds 2 binaries: > wrf_r and diffwrf_521. Both of them contain pretty much the same objects > that *are* built twice: > > gfortran -c -o module_mp_wsm5.fppized.o -I. -I./netcdf/include -I./inc -O2 > -march=native -std=legacy -fprofile-generate -fconvert=big-endian > -fno-openmp -g0 module_mp_wsm5.fppized.f90 > > then wrf_r is trained, module_mp_wsm5.fppized.gcda is properly created. > But then diffwrf_521 is invoked and the GCDA if overwritten: > > $ export GCOV_ERROR_FILE=/tmp/wrf.txt > ... > $ grep wsm5 /tmp/wrf.txt > libgcov profiling > error:/home/marxin/Programming/cpu2017/benchspec/CPU/521.wrf_r/build/ > build_peak_gcc-m64.0000/module_mp_wsm5.fppized.gcda:overwriting an existing > profile data with a different timestamp > > That explains why we end up with a profile that has relatively low > sum_max=4450478, as shown the profile comes from a verification binary > diffwrf_521. > > I don't have an easy solution for that. Maybe we can somehow drop > -fprofile-generate for diffwrf_521 binary. Is it possible? Why don't we simply merge the profiles for wrf and diffwrf for shared sources? How about adding GCOV_NO_OVERWRITE and set that for WRF so the overwrite does not happen? How about making the aux files have a prefix (from the executable?) , that is, from the data gcov decides on why it cannot merge the profiles?