https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119553
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jorgen Kvalsvik <j...@gcc.gnu.org>: https://gcc.gnu.org/g:de742091f4df997f426d99bcfed3c44914788033 commit r15-9072-gde742091f4df997f426d99bcfed3c44914788033 Author: Jørgen Kvalsvik <j...@lambda.is> Date: Mon Mar 31 19:03:37 2025 +0200 Only write gcov when file output is on [PR119553] gcov_write_* functions must be guarded so they only are called when output_to_file is true, like for -fcondition-coverage, otherwise it triggers an invalid read as detected by valgrind. The gcno file is mostly written to from profile.cc, so it doesn't make too much sense to hide it in path-coverage.cc. The find_paths name was a bit imprecise, and is renamed to instrument_prime_paths. PR gcov-profile/119553 gcc/ChangeLog: * path-coverage.cc (find_paths): Return path count, don't write to gcno, and rename to ... (instrument_prime_paths): ... this. * profile.cc (branch_prob): Write path counts to gcno.