[LLVMbugs] [Bug 15191] New: GCOVProfiling __gcov_flush only flushes the current compilation unit

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 6 16:45:17 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15191

            Bug ID: 15191
           Summary: GCOVProfiling __gcov_flush only flushes the current
                    compilation unit
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Miscellaneous Instrumentation passes
          Assignee: unassignedbugs at nondot.org
          Reporter: ash.gti at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Using clang with -ftest-coverage -fprofile-arcs and calling __gcov_flush will
only flush the current compilation unit instead of flushing all of the coverage
data.

For instance:

$ cat foo.c
#include <stdio.h>
void foo() {
  for (int i = 0; i < 10; i++) {
    printf("foo %d\n", i);
  }
  __gcov_flush();
}

$ cat main.c
#include <stdio.h>
extern void foo();
int main() {
  foo();
  for (int i = 0; i < 10; i++) {
    printf("main %d\n", i);
  }
  int *a;
  *a = 4; // Crashes the app, so only the flushed coverage prints
}

$ clang -fprofile-arcs -ftest-coverage -g foo.c main.c
$ ./a.out
[1]    74979 segmentation fault  ./a.out
$ gcov main.c 
main.gcda:cannot open data file, assuming not executed
File 'main.c'
Lines executed:0.00% of 7
main.c:creating 'main.c.gcov'


If you do the same thing with gcc, it will flush all of the buffers thus, it
produces some coverage data for main.c.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130207/062f0735/attachment.html>


More information about the llvm-bugs mailing list