<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 - Wrong line information at O3"
href="https://bugs.llvm.org/show_bug.cgi?id=46121">46121</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong line information at O3
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>DebugInfo
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>massarelli@diag.uniroma1.it
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
</td>
</tr></table>
<p>
<div>
<pre>Line 23 is hit twice. The second time that it is hit it seems to be wrong,
actually the execution seems to be in function p.
$ cat -n a.c
1 char a, b, c;
2 int d, e, g, h;
3 short f;
4 short j[8];
5 int *k = &d;
6 int(l)(m, n) {
7 return m && n && -1 / m || m && n > 1 / n || m <= 0 && n <= 0 && m &&
7 / m
8 ? 0
9 : m;
10 }
11 int o() { f = 0; }
12 void p(int *m) {
13 int ui1 = 4, ui2 = c = 4 * l(*m, c);
14 b = g;
15 h = b;
16 }
17 int main() {
18 int i = 0;
19 for (; i < 8; i++)
20 j[i] = 2;
21 a = 0;
22 for (; a <= 7; a++) {
23 j[a] || o();
24 p(k);
25 *k = e;
26 }
27 }
$ cat a.c
char a, b, c;
int d, e, g, h;
short f;
short j[8];
int *k = &d;
int(l)(m, n) {
return m && n && -1 / m || m && n > 1 / n || m <= 0 && n <= 0 && m && 7 / m
? 0
: m;
}
int o() { f = 0; }
void p(int *m) {
int ui1 = 4, ui2 = c = 4 * l(*m, c);
b = g;
h = b;
}
int main() {
int i = 0;
for (; i < 8; i++)
j[i] = 2;
a = 0;
for (; a <= 7; a++) {
j[a] || o();
p(k);
*k = e;
}
}
$ clang -v
clang version 11.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
da52aa2c3340d91025c0188175012c476967dc74)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
$ lldb -v
lldb version 11.0.0
clang revision da52aa2c3340d91025c0188175012c476967dc74
llvm revision da52aa2c3340d91025c0188175012c476967dc74
$ clang -O3 -g -o opt a.c
lldb opt
(lldb) target create "opt"
Current executable set to '/opt' (x86_64).
(lldb) b -l 23
Breakpoint 1: where = opt`main + 46 at test.c:23:5, address =
0x000000000040058e
(lldb) r
Process 228 launched: 'opt' (x86_64)
Process 228 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
frame #0: 0x000000000040058e opt`main at test.c:23:5
20 j[i] = 2;
21 a = 0;
22 for (; a <= 7; a++) {
-> 23 j[a] || o();
24 p(k);
25 *k = e;
26 }
(lldb) p a
(char) $0 = '\0'
(lldb) a
error: 'apropos' must be called with exactly one argument.
(lldb) s
Process 228 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x0000000000400593 opt`main [inlined] p(m=0x0000000000601040) at
test.c:23:10
20 j[i] = 2;
21 a = 0;
22 for (; a <= 7; a++) {
-> 23 j[a] || o();
24 p(k);
25 *k = e;
26 }</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>