[llvm-bugs] [Bug 38223] New: Closing braces have line hit counts where it shouldn't

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 19 05:44:40 PDT 2018


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

            Bug ID: 38223
           Summary: Closing braces have line hit counts where it shouldn't
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: profile
          Assignee: unassignedbugs at nondot.org
          Reporter: calixte.denizet at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20577
  --> https://bugs.llvm.org/attachment.cgi?id=20577&action=edit
Archive with GCNO, GCDA, source file and GCOV output

clang++-7 main.cpp --coverage -O0
./a.out
llvm-cov-7 gcov main.gcno

The result is:
        -:    0:Source:main.cpp
        -:    0:Graph:main.gcno
        -:    0:Data:main.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        -:    1:struct A {
        -:    2:    int x;
        1:    3:    A(int _x): x(_x)
        -:    4:        {
        1:    5:        }
        -:    6:
        1:    7:    ~A() { }
        -:    8:
        -:    9:    void get(int &r)
        -:   10:        {
       22:   11:            for (int i = 0; i < x; ++i)
        -:   12:            {
       10:   13:                r += i;
       10:   14:            }
        1:   15:        }
        -:   16:
        -:   17:    int get() const
        -:   18:        {
        1:   19:            return x;
        -:   20:        }
        -:   21:};
        -:   22:
        -:   23:int main()
        -:   24:{
        1:   25:    A a(10);
        -:   26:
        1:   27:    int r = 3;
        1:   28:    a.get(r);
        -:   29:
        2:   30:    r += a.get();
        -:   31:
        1:   32:    return r;
        1:   33:}

Lines 14, 15, 33 are hit.

With gcc-8, I get:
        -:    0:Source:main.cpp
        -:    0:Graph:main.gcno
        -:    0:Data:main.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        -:    1:struct A {
        -:    2:    int x;
        1:    3:    A(int _x): x(_x)
        -:    4:        {
        1:    5:        }
        -:    6:
        1:    7:    ~A() { }
        -:    8:
        1:    9:    void get(int &r)
        -:   10:        {
       11:   11:            for (int i = 0; i < x; ++i)
        -:   12:            {
       10:   13:                r += i;
        -:   14:            }
        1:   15:        }
        -:   16:
        1:   17:    int get() const
        -:   18:        {
        1:   19:            return x;
        -:   20:        }
        -:   21:};
        -:   22:
        1:   23:int main()
        -:   24:{
        1:   25:    A a(10);
        -:   26:
        1:   27:    int r = 3;
        1:   28:    a.get(r);
        -:   29:
        1:   30:    r += a.get();
        -:   31:
        1:   32:    return r;
        -:   33:}

-- 
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/20180719/2361315c/attachment.html>


More information about the llvm-bugs mailing list