]> git.ipfire.org Git - thirdparty/gcc.git/commit
Only write gcov when file output is on [PR119553]
authorJørgen Kvalsvik <j@lambda.is>
Mon, 31 Mar 2025 17:03:37 +0000 (19:03 +0200)
committerJørgen Kvalsvik <j@lambda.is>
Mon, 31 Mar 2025 17:47:14 +0000 (19:47 +0200)
commitde742091f4df997f426d99bcfed3c44914788033
tree3ffdfef4972b82709cee02f65b3a077e0de2daf5
parent44289d258a970e39059afa33d2a44d16ba41d3f2
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.
gcc/path-coverage.cc
gcc/profile.cc