https://gcc.gnu.org/g:a566f9efe1652b294e424e21e9910de2a011f4f1
commit r17-4472-ga566f9efe1652b294e424e21e9910de2a011f4f1 Author: Jørgen Kvalsvik <[email protected]> Date: Sat Sep 19 21:48:34 2026 +0200 Fix function summaries with suppressed blocks I found these while writing a test case for function summaries. The coverage.paths field was updated with the wrong count, which would for function summaries lead obviously wrong output like: 'Prime paths covered:0.00% of -1 (2 of 1 suppressed)' The numbers in the gcov report itself were fine. The missing else cause 'No conditions' to be output when it shouldn't: Calls executed:50.00% of 2 Condition outcomes covered:50.00% of 4 No conditions I apparently never tried these exact combinations with function summaries, which are occasionally useful, but I mostly used the detailed reports. gcc/ChangeLog: * gcov.cc (add_path_counts): Read the right field paths.size. (function_summary): Add missing else. Diff: --- gcc/gcov.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/gcov.cc b/gcc/gcov.cc index ceed689c1c98..bab0f893f034 100644 --- a/gcc/gcov.cc +++ b/gcc/gcov.cc @@ -3315,7 +3315,7 @@ add_condition_counts (coverage_info *coverage, const block_info *block) static void add_path_counts (coverage_info &coverage, const function_info &fn) { - coverage.paths += fn.paths.path_count (); + coverage.paths += fn.paths.paths.size (); coverage.paths_covered += fn.paths.covered_paths (); coverage.paths_suppressed += fn.paths.suppressed_count (); } @@ -3441,7 +3441,7 @@ function_summary (const coverage_info *coverage) format_gcov (coverage->conditions_covered, coverage->conditions, 2), coverage->conditions); - if (coverage->conditions && coverage->conditions_suppressed > 0) + else if (coverage->conditions && coverage->conditions_suppressed > 0) fnotice (stdout, "Condition outcomes covered:%s of %d" " (%d of %d suppressed)\n", format_gcov (coverage->conditions_covered,
