[llvm-bugs] [Bug 52239] New: Variable's value not available from second loop iteration at Og
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Oct 20 10:30:58 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52239
Bug ID: 52239
Summary: Variable's value not available from second loop
iteration at Og
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: unassignedbugs at nondot.org
Reporter: cristianassaiante at outlook.com
CC: jdevlieghere at apple.com, keith.walker at arm.com,
llvm-bugs at lists.llvm.org,
paul_robinson at playstation.sony.com
Variable l_143 value is not available at line 9 and 10 from the second loop
iteration, in fact it is only available at line 13 in the loop body.
>From bisect, this behavior may be caused by PostOrderFunctionAttrsPass on SCC
(f)
$ cat a.c
char a;
long b;
volatile int d;
char e(c) {
return a;
}
void f() {
int l_143 = 0;
for (;
b != 3;
++b) {
l_143 = 0;
l_143 = e(d);
}
}
int main () {
f();
}
$ clang -v
clang version 13.0.0
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 13.0.0
$ clang -g -Og -o opt a.c
(lldb) target create "opt"
Current executable set to '/home/stepping/56/reduce/opt' (x86_64).
(lldb) b 10
Breakpoint 1: 2 locations.
(lldb) run
Process 247 launched: '/home/stepping/56/reduce/opt' (x86_64)
Process 247 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.2
frame #0: 0x00000000004004d0 opt`main [inlined] f at a.c:10:9
7 void f() {
8 int l_143 = 0;
9 for (;
-> 10 b != 3;
11 ++b) {
12 l_143 = 0;
13 l_143 = e(d);
(lldb) frame var
(int) l_143 = 0
(lldb) n
Process 247 stopped
* thread #1, name = 'opt', stop reason = step over
frame #0: 0x00000000004004db opt`main [inlined] f at a.c:9:5
6 }
7 void f() {
8 int l_143 = 0;
-> 9 for (;
10 b != 3;
11 ++b) {
12 l_143 = 0;
(lldb) frame var
(int) l_143 = 0
(lldb) n
Process 247 stopped
* thread #1, name = 'opt', stop reason = step over
frame #0: 0x00000000004004f0 opt`main [inlined] f at a.c:13:19
10 b != 3;
11 ++b) {
12 l_143 = 0;
-> 13 l_143 = e(d);
14 }
15 }
16 int main () {
(lldb) n
Process 247 stopped
* thread #1, name = 'opt', stop reason = step over
frame #0: 0x00000000004004f6 opt`main [inlined] f at a.c:10:11
7 void f() {
8 int l_143 = 0;
9 for (;
-> 10 b != 3;
11 ++b) {
12 l_143 = 0;
13 l_143 = e(d);
(lldb) frame var
(int) l_143 = <variable not available>
(lldb) n
Process 247 stopped
* thread #1, name = 'opt', stop reason = step over
frame #0: 0x00000000004004f9 opt`main [inlined] f at a.c:9:5
6 }
7 void f() {
8 int l_143 = 0;
-> 9 for (;
10 b != 3;
11 ++b) {
12 l_143 = 0;
(lldb) frame var
(int) l_143 = <variable not available>
(lldb) n
Process 247 stopped
* thread #1, name = 'opt', stop reason = step over
frame #0: 0x00000000004004f0 opt`main [inlined] f at a.c:13:19
10 b != 3;
11 ++b) {
12 l_143 = 0;
-> 13 l_143 = e(d);
14 }
15 }
16 int main () {
(lldb) frame var
(int) l_143 = 0
--
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/20211020/27a0962d/attachment-0001.html>
More information about the llvm-bugs
mailing list