[llvm-bugs] [Bug 45883] New: Wrong Back Trace Information at O3

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 12 02:13:01 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45883

            Bug ID: 45883
           Summary: Wrong Back Trace Information at O3
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: wrong-debug
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: massarelli at diag.uniroma1.it
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    ditaliano at apple.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

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 (https://github.com/llvm/llvm-project.git
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)

-- 
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/20200512/727be86e/attachment.html>


More information about the llvm-bugs mailing list