<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 variable value change during debugging at Og"
href="https://bugs.llvm.org/show_bug.cgi?id=45886">45886</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong variable value change during debugging at Og
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>massarelli@diag.uniroma1.it
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The variable b inside function a changes value unexpectedly at line 3.
$ cat a.c
void a(b) {
printf("%X\n");
}
int main() {
a(0);
}
$ lldb -v
lldb version 11.0.0
clang revision c25b20c0f6c13d68dbc2e185764082d61ae4a132
llvm revision c25b20c0f6c13d68dbc2e185764082d61ae4a132
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/bin/../libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/tmp/gcc_build --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200511 (experimental) (GCC)
$ gcc -Og -g -o opt_2 a.c
$ lldb opt_2
(lldb) b main
Breakpoint 1: where = opt_2`main + 4 at a.c:6:3, address = 0x000000000040050e
(lldb) r
Process 313 launched: 'opt_2' (x86_64)
Process 313 stopped
* thread #1, name = 'opt_2', stop reason = breakpoint 1.1
frame #0: 0x000000000040050e opt_2`main at a.c:6:3
3 }
4
5 int main() {
-> 6 a(0);
7 }
(lldb) s
Process 313 stopped
* thread #1, name = 'opt_2', stop reason = step in
frame #0: 0x00000000004004f2 opt_2`a(b=0) at a.c:1:11
-> 1 void a(b) {
2 printf("%X\n");
3 }
4
5 int main() {
6 a(0);
7 }
(lldb) s
Process 313 stopped
* thread #1, name = 'opt_2', stop reason = step in
frame #0: 0x00000000004004f6 opt_2`a(b=0) at a.c:2:3
1 void a(b) {
-> 2 printf("%X\n");
3 }
4
5 int main() {
6 a(0);
7 }
(lldb) s
FFFFE5B8
Process 313 stopped
* thread #1, name = 'opt_2', stop reason = step in
frame #0: 0x0000000000400505 opt_2`a(b=1) at a.c:3:1
1 void a(b) {
2 printf("%X\n");
-> 3 }
4
5 int main() {
6 a(0);
7 }
(lldb) p b
(int) $0 = 1</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>