[llvm-bugs] [Bug 52238] New: Variable's value late availability and incorrect at Og
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Oct 20 10:23:15 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52238
Bug ID: 52238
Summary: Variable's value late availability and incorrect 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_5 value is not available on line 4 even if its assignment has been
done and it becomes available at line 6.
Moreover, the value of the variable seems to be wrong since lldb shows 1 but
the assignment at line 7 has not been reached yet.
>From bisect, this behavior may be caused by Branch Probability Basic Block
Placement on function (main).
$ cat a.c
volatile int a, b;
void c() {
int l_5 = 5;
for (;
b >= 0;
b --) {
l_5 = 1;
}
}
int main () {
c();
}
$ 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 opt
(lldb) target create "opt"
Current executable set to '/home/stepping/40/reduce/opt' (x86_64).
(lldb) b 3
Breakpoint 1: 2 locations.
(lldb) run
Process 197 launched: '/home/stepping/40/reduce/opt' (x86_64)
Process 197 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.2
frame #0: 0x00000000004004b7 opt`main [inlined] c at a.c:4:5
1 volatile int a, b;
2 void c() {
3 int l_5 = 5;
-> 4 for (;
5 b >= 0;
6 b --) {
7 l_5 = 1;
(lldb) frame var
(int) l_5 = <variable not available>
(lldb) n
Process 197 stopped
* thread #1, name = 'opt', stop reason = step over
frame #0: 0x00000000004004c0 opt`main [inlined] c at a.c:6:11
3 int l_5 = 5;
4 for (;
5 b >= 0;
-> 6 b --) {
7 l_5 = 1;
8 }
9 }
(lldb) frame var
(int) l_5 = 1
--
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/2ced990d/attachment.html>
More information about the llvm-bugs
mailing list