<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 Stepping Behaviour at Og"
href="https://bugs.llvm.org/show_bug.cgi?id=51561">51561</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong Stepping Behaviour at Og
</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>artuso@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>Comment:
After stepping on line 27, the debugger steps back inside the main function on
line 39 and then it comes back at line 27 (The disassembly wrongly shows that
lines 39 and 27 are associated with nop instructions only).
Steps to reproduce bug:
root@c79e7fb993cd:/home/stepping/output# clang -v
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
957334382cd12ec07b46c0ddfdcc220731f6d80f)
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
root@c79e7fb993cd:/home/stepping/output# lldb -v
lldb version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a> revision
957334382cd12ec07b46c0ddfdcc220731f6d80f)
clang revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
llvm revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
root@c79e7fb993cd:/home/stepping/output# cat a.c
char g_432[2][1][3] ;
int g_7714, g_15741, a ;
int g_11542[8] ;
short b[3][1];
short safe_add_func_int16_t_s_s( c, d ) {
return d;
}
short safe_sub_func_int16_t_s_s( c, d ) {
return 0;
}
short safe_mod_func_int16_t_s_s( c, d ) {
return 0;
}
short safe_sub_func_uint16_t_u_u( c, d ) {
return d;
}
short e() {
char p_14 = 0;
int p_13 = 0;
int l_17443[][5][2] = {
0}
;
char l_17448[][3] = {
3, 1, 7, 5 }
;
short l_17449 = 0;
g_7714 =
(safe_sub_func_int16_t_s_s((safe_mod_func_int16_t_s_s((p_14 != 0x217B),
0x031E)), (p_13 | ((((l_17443[0][4][1] < p_14) <
(safe_sub_func_uint16_t_u_u(((safe_add_func_int16_t_s_s(p_14, (g_15741 <
g_432[1][0][2]))) <= g_11542[7]), l_17448[1][2]))) || 0x379B6C12) <
l_17449))));
return 1;
}
void func_2(c) {
a = 0;
for (;
a < 3;
a++) {
b[a][0] = 3;
}
}
int main () {
func_2( e() ) ;
}
root@c79e7fb993cd:/home/stepping/output# cat -n a.c
1 char g_432[2][1][3] ;
2 int g_7714, g_15741, a ;
3 int g_11542[8] ;
4 short b[3][1];
5 short safe_add_func_int16_t_s_s( c, d ) {
6 return d;
7 }
8 short safe_sub_func_int16_t_s_s( c, d ) {
9 return 0;
10 }
11 short safe_mod_func_int16_t_s_s( c, d ) {
12 return 0;
13 }
14 short safe_sub_func_uint16_t_u_u( c, d ) {
15 return d;
16 }
17 short e() {
18 char p_14 = 0;
19 int p_13 = 0;
20 int l_17443[][5][2] = {
21 0}
22 ;
23 char l_17448[][3] = {
24 3, 1, 7, 5 }
25 ;
26 short l_17449 = 0;
27 g_7714 =
(safe_sub_func_int16_t_s_s((safe_mod_func_int16_t_s_s((p_14 != 0x217B),
0x031E)), (p_13 | ((((l_17443[0][4][1] < p_14) <
(safe_sub_func_uint16_t_u_u(((safe_add_func_int16_t_s_s(p_14, (g_15741 <
g_432[1][0][2]))) <= g_11542[7]), l_17448[1][2]))) || 0x379B6C12) <
l_17449))));
28 return 1;
29 }
30 void func_2(c) {
31 a = 0;
32 for (;
33 a < 3;
34 a++) {
35 b[a][0] = 3;
36 }
37 }
38 int main () {
39 func_2( e() ) ;
40
}
root@c79e7fb993cd:/home/stepping/output# clang -Og -g -Wno-everything -o opt
a.c
root@c79e7fb993cd:/home/stepping/output# lldb opt
(lldb) target create "opt"
Current executable set to '/home/stepping/output/opt' (x86_64).
(lldb) b main
Breakpoint 1: where = opt`main [inlined] e at a.c:27:33, address =
0x0000000000400500
(lldb) r
Process 71083 launched: '/home/stepping/output/opt' (x86_64)
Process 71083 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
frame #0: 0x0000000000400500 opt`main [inlined] e at a.c:27:33
24 3, 1, 7, 5 }
25 ;
26 short l_17449 = 0;
-> 27 g_7714 =
(safe_sub_func_int16_t_s_s((safe_mod_func_int16_t_s_s((p_14 != 0x217B),
0x031E)), (p_13 | ((((l_17443[0][4][1] < p_14) <
(safe_sub_func_uint16_t_u_u(((safe_add_func_int16_t_s_s(p_14, (g_15741 <
g_432[1][0][2]))) <= g_11542[7]), l_17448[1][2]))) || 0x379B6C12) <
l_17449))));
28 return 1;
29 }
30 void func_2(c) {
(lldb) si
Process 71083 stopped
* thread #1, name = 'opt', stop reason = instruction step into
frame #0: 0x000000000040050a opt`main [inlined] e at a.c:27:33
24 3, 1, 7, 5 }
25 ;
26 short l_17449 = 0;
-> 27 g_7714 =
(safe_sub_func_int16_t_s_s((safe_mod_func_int16_t_s_s((p_14 != 0x217B),
0x031E)), (p_13 | ((((l_17443[0][4][1] < p_14) <
(safe_sub_func_uint16_t_u_u(((safe_add_func_int16_t_s_s(p_14, (g_15741 <
g_432[1][0][2]))) <= g_11542[7]), l_17448[1][2]))) || 0x379B6C12) <
l_17449))));
28 return 1;
29 }
30 void func_2(c) {
(lldb) si
Process 71083 stopped
* thread #1, name = 'opt', stop reason = instruction step into
frame #0: 0x0000000000400511 opt`main at a.c:39:36
36 }
37 }
38 int main () {
-> 39 func_2( e() ) ;
40 }
(lldb) di -l
opt`main:
-> 0x400511 <+17>: nopw %cs:(%rax,%rax)
0x40051b <+27>: nopl (%rax,%rax)
34 a++) {
** 35 b[a][0] = 3;
36 }
37 }
0x400520 <+32>: movw $0x3, 0x60107e(%rax)
** 33 a < 3;
0x400529 <+41>: addq $0x2, %rax
30 void func_2(c) {
31 a = 0;
** 32 for (;
0x40052d <+45>: jne 0x400520 ; <+32> [inlined] func_2 +
15 at a.c:35:35
(lldb) si
Process 71083 stopped
* thread #1, name = 'opt', stop reason = instruction step into
frame #0: 0x000000000040051b opt`main [inlined] func_2 at a.c:27:33
24 3, 1, 7, 5 }
25 ;
26 short l_17449 = 0;
-> 27 g_7714 =
(safe_sub_func_int16_t_s_s((safe_mod_func_int16_t_s_s((p_14 != 0x217B),
0x031E)), (p_13 | ((((l_17443[0][4][1] < p_14) <
(safe_sub_func_uint16_t_u_u(((safe_add_func_int16_t_s_s(p_14, (g_15741 <
g_432[1][0][2]))) <= g_11542[7]), l_17448[1][2]))) || 0x379B6C12) <
l_17449))));
28 return 1;
29 }
30 void func_2(c) {
(lldb) di -l
opt`main:
0x400500 <+0>: movl $0x0, 0x200b66(%rip) ; g_11542 + 28
0x40050a <+10>: movq $-0x6, %rax
0x400511 <+17>: nopw %cs:(%rax,%rax)
-> 0x40051b <+27>: nopl (%rax,%rax)
(lldb) si
Process 71083 stopped
* thread #1, name = 'opt', stop reason = instruction step into
frame #0: 0x0000000000400520 opt`main [inlined] func_2 at a.c:35:35
32 for (;
33 a < 3;
34 a++) {
-> 35 b[a][0] = 3;
36 }
37 }
38 int main () {</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>