https://gcc.gnu.org/g:9c09713871ad6d05e1bd2bd65cb3c78c823cb42e

commit r17-4265-g9c09713871ad6d05e1bd2bd65cb3c78c823cb42e
Author: Jørgen Kvalsvik <[email protected]>
Date:   Tue Sep 15 16:04:12 2026 +0200

    Compare right field when printing summary
    
    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.
    
            PR gcov-profile/127408
    
    gcc/ChangeLog:
    
            * gcov.cc (function_summary): Check calls_suppressed, not calls.

Diff:
---
 gcc/gcov.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/gcov.cc b/gcc/gcov.cc
index 06047a604607..ceed689c1c98 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);

Reply via email to