TUESDAY, SEPTEMBER 15, 2026
gcc/gcov
Fix incorrect check in gcov function summary logic
Corrects a logical error in gcov's function summary reporting that could lead to incorrect output.
This commit fixes a bug in gcov.cc where an incorrect condition was used for generating function summaries. The check coverage->calls == 0 was always false, leading to potentially wrong reporting. The fix changes the condition to correctly check calls_suppressed, ensuring accurate summary generation.
In Details
The gcov.cc function_summary function had a flawed check coverage->calls && coverage->calls == 0, which is logically always false. This commit corrects it to coverage->calls_suppressed to properly handle suppression pragmas and the reporting of call counts, addressing PR gcov-profile/127408.
For Context
- gcov
- A code coverage analysis tool for GCC. It helps developers understand which parts of their code are executed during testing.
- function summary
- A summary of execution statistics for a function, often generated by code coverage tools like gcov.
- calls_suppressed
- A flag or variable in gcov indicating whether call count instrumentation has been suppressed for a particular function or region of code, typically via a pragma.