<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 Back Trace Information at O3"
   href="https://bugs.llvm.org/show_bug.cgi?id=45883">45883</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong Back Trace Information at O3
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>Keywords</th>
          <td>wrong-debug
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>massarelli@diag.uniroma1.it
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, ditaliano@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Backtrace information seems wrong with O3 at line 17.

$ cat a.c
volatile int a, c;
int b;
void d() {
  int *e = &b;
f:
  *e ^= 10;
  if (b)
    goto f;
}
void g(int *h) {
  if (!0 ^ b)
    *h = 0;
}
int main() {
  g(&b);
  c;
  a;
  d();
}

$ clang -v
clang version 11.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
c25b20c0f6c13d68dbc2e185764082d61ae4a132)
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
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/11.0.0
Selected GCC installation: /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/11.0.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

$ lldb -v
lldb version 11.0.0
  clang revision c25b20c0f6c13d68dbc2e185764082d61ae4a132
  llvm revision c25b20c0f6c13d68dbc2e185764082d61ae4a132

$ clang -O3 -g -o opt a.c

$ lldb opt 
(lldb) target create "opt"
Current executable set to 'opt' (x86_64).
(lldb) b -l 17
Breakpoint 1: where = opt`main + 32 at a.c:17:3, address = 0x00000000004004d0
(lldb) r
Process 172 launched: 'opt' (x86_64)
Process 172 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x00000000004004d0 opt`main at a.c:17:3
   14   int main() {
   15     g(&b);
   16     c;
-> 17     a;
   18     d();
   19   }
(lldb) bt
* thread #1, name = 'opt', stop reason = breakpoint 1.1
  * frame #0: 0x00000000004004d0 opt`main at a.c:17:3
    frame #1: 0x00007ffff7a05b97 libc.so.6`__libc_start_main + 231
    frame #2: 0x00000000004003ba opt`_start + 42
(lldb) s
Process 172 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x00000000004004d6 opt`main [inlined] d at a.c:17:3
   14   int main() {
   15     g(&b);
   16     c;
-> 17     a;
   18     d();
   19   }
(lldb) bt
* thread #1, name = 'opt', stop reason = step in
  * frame #0: 0x00000000004004d6 opt`main [inlined] d at a.c:17:3
    frame #1: 0x00000000004004d6 opt`main at a.c:18
    frame #2: 0x00007ffff7a05b97 libc.so.6`__libc_start_main + 231
    frame #3: 0x00000000004003ba opt`_start + 42
(lldb)</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>