The check
if (coverage->calls && coverage->calls == 0)
will always be false (as reported by -Wlogical-op) and broken. I
don't think there is a test suite for function summaries so this was
not caught earlier.
The logic is a bit awkward and could've been flipped to avoid checking
calls_suppressed twice. When it was written I wanted to minimize
patch and preserve the "natural" order, since the suppression pragma
is an opt-in, in a way.
Bootstrapped on x86_64-linux-gnu, pushed as obvious.
PR gcov-profile/127408
gcc/ChangeLog:
* gcov.cc (function_summary): Check calls_suppressed, not calls.
---
gcc/gcov.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/gcov.cc b/gcc/gcov.cc
index 06047a60460..ceed689c1c9 100644
--- a/gcc/gcov.cc
+++ b/gcc/gcov.cc
@@ -3421,7 +3421,7 @@ function_summary (const coverage_info *coverage)
else
fnotice (stdout, "No branches\n");
- if (coverage->calls && coverage->calls == 0)
+ if (coverage->calls && coverage->calls_suppressed == 0)
fnotice (stdout, "Calls executed:%s of %d\n",
format_gcov (coverage->calls_executed, coverage->calls, 2),
coverage->calls);
--
2.47.3