https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89000
Bug ID: 89000 Summary: gcov --function-summaries says No branches/No calls, only the File summary is correct Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: steven.w.carmer at lmco dot com CC: marxin at gcc dot gnu.org Target Milestone: --- gcc -v output COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/appl/lucy_local_sde/Linux-RHEL7-x86_64/gcc-8.2.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/8.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /appl/lucy_local_sde/src/gcc/gcc-8.2.0/x86_64-Linux-3.10/gcc-8.2.0-obj/../gcc-8.2.0/configure --prefix=/usr/local/sde/gcc-8.2.0 --disable-nls --enable-shared --enable-static --enable-multilib --with-multilib-list=m32,m64 --enable-languages=c,c++,fortran Thread model: posix gcc version 8.2.0 (GCC) When using the -f (--function-summaries) option with gcov, it does not provide the branch/call statistics for the functions. The file summary is correct, and the *gcov output file that gets created shows it has the branch/call information that the -f option relies upon, but the gcov -f output just shows "No branches/No calls" for all the function summaries. A trivial example source code file gcov_test.c that produces these results: #include <stdio.h> #include <stdlib.h> #include <stdbool.h> void foo(void); void foo(void) { static bool firstPass = true; if (firstPass) { firstPass = false; printf ("First Pass\n"); } else { printf ("Not First Pass\n"); } } int main (int argc, char *argv[]) { foo(); foo(); foo(); return 0; } Compile that C file with the following: gcc -fprofile-arcs -ftest-coverage gcov_test.c Run the executable to produce the gcov artifacts ./a.out And then run the following to view the coverage report gcov -b gcov_test.c -f Function 'main' Lines executed:100.00% of 5 No branches No calls Function 'foo' Lines executed:100.00% of 6 No branches No calls File 'gcov_test.c' Lines executed:100.00% of 11 Branches executed:100.00% of 2 Taken at least once:100.00% of 2 Calls executed:100.00% of 5 Creating 'gcov_test.c.gcov' Note the "No branches" and "No calls" output. With gcc/gcov 7.4 (and older), the output looks like this: Function 'main' Lines executed:100.00% of 5 No branches Calls executed:100.00% of 3 Function 'foo' Lines executed:100.00% of 6 Branches executed:100.00% of 2 Taken at least once:100.00% of 2 Calls executed:100.00% of 2 File 'gcov_test.c' Lines executed:100.00% of 11 Branches executed:100.00% of 2 Taken at least once:100.00% of 2 Calls executed:100.00% of 5 Creating 'gcov_test.c.gcov'