[llvm-bugs] [Bug 40833] New: Wrong debug info generated at -O1 (-O0 is correct)

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Feb 23 15:01:04 PST 2019


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

            Bug ID: 40833
           Summary: Wrong debug info generated at -O1 (-O0 is correct)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: llvm-bugs at lists.llvm.org

$ cat outer.c
void optimize_me_not() {}

$ cat a.c
int b;
short c;
int(a)(d, e) { return d + e; }
int main() {
  char l_658 = 9;
  for (; b < 26; b = b + 6) {
    c = -28;
    for (; c != 14; c = a(c, 7))
      ++l_658;
  }
  optimize_me_not();
}

$ clang-trunk a.c outer.c -O1 -g

(lldb) br set -p optimize_me_not
Breakpoint 1: where = a.out`main + 72 at 1.c:11:3, address = 0x00000000004004d8
(lldb) r
Process 14706 launched: '/home/davide/finished_reducing/a.out' (x86_64)
Process 14706 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x00000000004004d8 a.out`main at 1.c:11:3
   8        for (; c != 14; c = a(c, 7))
   9          ++l_658;
   10     }
-> 11     optimize_me_not();
   12   }
(lldb) p l_658
(char) $0 = '\t'

$ clang-trunk 1.c outer.c -O0 -g

(lldb) br set -p optimize_me_not
Breakpoint 1: where = a.out`main + 129 at 1.c:11:3, address =
0x0000000000400521
(lldb) r
Process 22881 launched: '/home/davide/finished_reducing/a.out' (x86_64)
Process 22881 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400521 a.out`main at 1.c:11:3
   8        for (; c != 14; c = a(c, 7))
   9          ++l_658;
   10     }
-> 11     optimize_me_not();
   12   }
(lldb) p l_658
(char) $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/20190223/d570223b/attachment.html>


More information about the llvm-bugs mailing list