<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 - The line number of YAML optimization record file is wrong if using #line directive."
href="https://bugs.llvm.org/show_bug.cgi?id=38321">38321</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>The line number of YAML optimization record file is wrong if using #line directive.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ueno.masakazu@jp.fujitsu.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>* version of clang
$ clang -v
clang version 6.0.0 (tags/RELEASE_600/final)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/local/llvm-6.0.0/install/bin
Found candidate GCC installation: /usr/lib/gcc/aarch64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/aarch64-redhat-linux/4.8.5
Selected GCC installation: /usr/lib/gcc/aarch64-redhat-linux/4.8.5
Candidate multilib: .;@m64
Selected multilib: .;@m64
* example
[Using #line directive]
$ clang -O3 -fsave-optimization-record line_on.c
$ llvm-opt-report line_on.opt.yaml
< line_on.c
1 | #include <stdio.h>
2 |
3 V2,2 | double a[10000],b[10000];
4 | void sub(int n)
5 | {
6 | int i;
7 | for(i=0;i<n;i++)
8 | {
9 I | a[i]=b[i];
10 | }
11 | }
12 |
13 | int main()
14 | {
15 | int i;
16 | # 3
17 | for(i=0;i<10000;i++)
18 | {
19 | b[i]=5;
20 | }
21 | for(i=0;i<100000;i++)
22 | {
23 | sub(10000);
24 | }
25 | printf("%f\n",a[10]);
26 | return 0;
27 | }
28 |
[NOT using #line directive => No problem]
$ clang -O3 -fsave-optimization-record line_off.c
$ llvm-opt-report line_off.opt.yaml
< line_off.c
1 | #include <stdio.h>
2 |
3 | double a[10000],b[10000];
4 | void sub(int n)
5 | {
6 | int i;
7 | for(i=0;i<n;i++)
8 | {
9 | a[i]=b[i];
10 | }
11 | }
12 |
13 | int main()
14 | {
15 | int i;
16 V2,2 | for(i=0;i<10000;i++)
17 | {
18 | b[i]=5;
19 | }
20 | for(i=0;i<100000;i++)
21 | {
22 I | sub(10000);
23 | }
24 | printf("%f\n",a[10]);
25 | return 0;
26 | }
27 |</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>