[llvm-bugs] [Bug 37071] New: [LLVM-COV] Wrong coverage with shift operators in macro

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 10 08:28:38 PDT 2018


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

            Bug ID: 37071
           Summary: [LLVM-COV] Wrong coverage with shift operators in
                    macro
           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
#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * 8) - (b))))

char c = 0xf234;

main ()
{
  if (ROR (c, 4) != ROR (c, 4))
    exit (1);

  exit (0);
}

$ clang -w -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|      2|#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * 8) -
(b))))
    2|       |
    3|       |char c = 0xf234;
    4|       |
    5|       |main ()
    6|      1|{
    7|      1|  if (ROR (c, 4) != ROR (c, 4))
    8|      1|    exit (1);
    9|      1|
   10|      1|  exit (0);
   11|      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/20180410/99430940/attachment.html>


More information about the llvm-bugs mailing list