[llvm-bugs] [Bug 42106] New: Coverage with option "--coverage" instruments sanitizer's code.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 2 10:39:18 PDT 2019


            Bug ID: 42106
           Summary: Coverage with option "--coverage" instruments
                    sanitizer's code.
           Product: compiler-rt
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: profile
          Assignee: unassignedbugs at nondot.org
          Reporter: valerakonychev at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 22065
  --> https://bugs.llvm.org/attachment.cgi?id=22065&action=edit

If code is compiled with options "--coverage" and "-fsanitize", result coverage
report will contain information about branches of sanitizers code. 

For example, I compiled simple program main.c:
clang -O0 -g --coverage -fsanitize=address,undefined main.c -o main

int main()
    float a = 1.0;
    return 0;

llvm-cov gcov main.c shows:
        -:    0:Source:main.c
        -:    0:Graph:main.gcno
        -:    0:Data:main.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        -:    1:int main()
        -:    2:{
        2:    3:    float a = 1.0; // !!!!!! Problem !!!!!!!
        1:    4:    return 0;
        1:    5:}

Result html report made with gcovr:
gcovr --html --html-details --gcov-executable='llvm-cov gcov' -r . -o cov.html

I've attached report in cov.main.c.html

The report shows coverage assumes there is an branch at the line '3:    float a
= 1.0;'. This branch is added by sanitizer's code, I've checked it by excluding
option "-fsanitize".

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/20190602/b5fb4b19/attachment.html>

More information about the llvm-bugs mailing list