[llvm-bugs] [Bug 35387] New: Coverage: line count incorrect for single statement for/while loop

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 22 09:09:14 PST 2017


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

            Bug ID: 35387
           Summary: Coverage: line count incorrect for single statement
                    for/while loop
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: eveson.sean at gmail.com
                CC: llvm-bugs at lists.llvm.org, vsk at apple.com

Hi,

Lines 4 and 6 in the following llvm-cov output are never executed, but have a
count of 1.

    1|      1|int main() {
    2|      1|  int x;
    3|      1|  while (0)
    4|      1|    ++x;
    5|      1|  for (;0;)
    6|      1|    ++x;
    7|      1|  return 0;
    8|      1|}

The count *is* correct in the following cases:

  while (0) {
    ++x; // Count is 0.
  }
  for (;0;) {
    ++x; // Count is 0.
  }
  if (0)
    ++x; // Count is 0.

I suspect this is the same issue that was fixed for `if` in r317758
(https://reviews.llvm.org/rL317758).

-- 
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/20171122/19f67704/attachment.html>


More information about the llvm-bugs mailing list