<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Closing braces have line hit counts where it shouldn't"
href="https://bugs.llvm.org/show_bug.cgi?id=38223">38223</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Closing braces have line hit counts where it shouldn't
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>profile
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>calixte.denizet@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=20577" name="attach_20577" title="Archive with GCNO, GCDA, source file and GCOV output">attachment 20577</a> <a href="attachment.cgi?id=20577&action=edit" title="Archive with GCNO, GCDA, source file and GCOV output">[details]</a></span>
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:}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>