[llvm-bugs] [Bug 35493] New: [LLVM-COV] statements after two labels and '||' operator are wrongly marked as not executed in llvm-cov

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 1 04:20:14 PST 2017


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

            Bug ID: 35493
           Summary: [LLVM-COV] statements after two labels and '||'
                    operator are wrongly marked as not executed in
                    llvm-cov
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yangyibiao at nju.edu.cn
                CC: llvm-bugs at lists.llvm.org

$ clang -v
clang version 6.0.0-svn319460-1~exp1 (trunk)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.2.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

$ cat small.c
void main()
{
    int g = 1;
    if (1){
        if (1)
            goto lbl2;
lbl1:
        g++;
lbl2:
        g = 1 || 0;
        g = 0;
    }
    return;
}

$ clang -w -O0 -g -fcoverage-mapping -fprofile-instr-generate=small.profraw
small.c -I/usr/include/csmith; ./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|       |void main()
    2|      1|{
    3|      1|    int g = 1;
    4|      1|    if (1){
    5|      1|        if (1)
    6|      1|            goto lbl2;
    7|      0|lbl1:
    8|      0|        g++;
    9|      1|lbl2:
   10|      1|        g = 1 || 0;
   11|      0|        g = 0;
   12|      0|    }
   13|      1|    return;
   14|      1|}

As we can find that Line #11 and #12 were wrongly marked as not 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/20171201/23c20912/attachment-0001.html>


More information about the llvm-bugs mailing list