[llvm-bugs] [Bug 51561] New: Wrong Stepping Behaviour at Og
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Aug 20 08:17:03 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51561
Bug ID: 51561
Summary: Wrong Stepping Behaviour at Og
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: unassignedbugs at nondot.org
Reporter: artuso at diag.uniroma1.it
CC: jdevlieghere at apple.com, keith.walker at arm.com,
llvm-bugs at lists.llvm.org,
paul_robinson at playstation.sony.com
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 at c79e7fb993cd:/home/stepping/output# clang -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
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 at c79e7fb993cd:/home/stepping/output# lldb -v
lldb version 14.0.0 (https://github.com/llvm/llvm-project.git revision
957334382cd12ec07b46c0ddfdcc220731f6d80f)
clang revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
llvm revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
root at 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 at 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 at c79e7fb993cd:/home/stepping/output# clang -Og -g -Wno-everything -o opt
a.c
root at 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 () {
--
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/20210820/b8133edd/attachment.html>
More information about the llvm-bugs
mailing list