[llvm-bugs] [Bug 37102] New: [LLVM-COV] Wrong coverage with the comparison of extern function pointer and NULL

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 12 01:31:45 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37102

            Bug ID: 37102
           Summary: [LLVM-COV] Wrong coverage with the comparison of
                    extern function pointer and NULL
           Product: Runtime Libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: libprofile library
          Assignee: unassignedbugs at nondot.org
          Reporter: yangyibiao at nju.edu.cn
                CC: llvm-bugs at lists.llvm.org

$ cat small.c
#include <stdlib.h>

extern int (*_Unwind_RaiseException) (void *) __attribute__((weak));

int main(void)
{
  if (&_Unwind_RaiseException != NULL)
    return 0;
  return 1;
}

$ clang -O0 -g -fcoverage-mapping -fprofile-instr-generate=small.profraw
small.c; ./a.out; llvm-profdata merge small.profraw -o small.profdata; llvm-cov
show a.out -instr-profile=small.profdata small.c > small.gcov; cat small.gcov
    1|       |#include <stdlib.h>
    2|       |
    3|       |extern int (*_Unwind_RaiseException) (void *)
__attribute__((weak));
    4|       |
    5|       |int main(void)
    6|      1|{
    7|      1|  if (&_Unwind_RaiseException != NULL)
    8|      1|    return 0;
    9|      1|  return 1;
   10|      1|}


Line #8 is wrongly marked as executed.

-- 
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/20180412/2dfba6ce/attachment-0001.html>


More information about the llvm-bugs mailing list