[llvm-bugs] [Bug 47232] New: Missing debug line information for some cases
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Aug 19 04:02:02 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47232
Bug ID: 47232
Summary: Missing debug line information for some cases
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: i at i-m.dev
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Look at this simple code, we compile it with `clang -O0 -g main.c`
int main() {
int v = -42;
do {
if (v <= 0) {
v = 1024 - v;
} else if (v % 2) {
v = v * 3 + 1;
} else {
v = v / 2;
} // here the debug becomes 0
} while (1 != v);
}
However, clang generate wrong debug line information for the `}` line of second
else statement. line of address `0x000000000040116d` is zero. I tried on
Linux/macOS for various versions of clang, the problem reproduced.
Address Line Column File ISA Discriminator Flags
------------------ ------ ------ ------ --- ------------- -------------
0x0000000000401110 1 0 1 0 0 is_stmt
0x000000000040111b 2 9 1 0 0 is_stmt prologue_end
0x0000000000401122 4 15 1 0 0 is_stmt
0x0000000000401126 4 13 1 0 0
0x000000000040112c 5 22 1 0 0 is_stmt
0x0000000000401134 5 15 1 0 0
0x0000000000401137 6 9 1 0 0 is_stmt
0x000000000040113c 6 20 1 0 0
0x000000000040113f 6 22 1 0 0
0x000000000040114a 6 20 1 0 0
0x0000000000401150 7 19 1 0 0 is_stmt
0x0000000000401154 7 23 1 0 0
0x0000000000401157 7 15 1 0 0
0x000000000040115a 8 9 1 0 0 is_stmt
0x000000000040115f 9 17 1 0 0 is_stmt
0x0000000000401162 9 19 1 0 0
0x000000000040116a 9 15 1 0 0
0x000000000040116d 0 15 1 0 0
0x0000000000401172 11 5 1 0 0 is_stmt
0x0000000000401177 11 16 1 0 0
0x000000000040117f 11 5 1 0 0
0x0000000000401185 12 1 1 0 0 is_stmt
0x000000000040118a 12 1 1 0 0 is_stmt end_sequence
0000000000401110 <main>:
401110: 55 push %rbp
401111: 48 89 e5 mov %rsp,%rbp
401114: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
40111b: c7 45 f8 d6 ff ff ff movl $0xffffffd6,-0x8(%rbp)
401122: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
401126: 0f 8f 10 00 00 00 jg 40113c <main+0x2c>
40112c: b8 00 04 00 00 mov $0x400,%eax
401131: 2b 45 f8 sub -0x8(%rbp),%eax
401134: 89 45 f8 mov %eax,-0x8(%rbp)
401137: e9 36 00 00 00 jmpq 401172 <main+0x62>
40113c: 8b 45 f8 mov -0x8(%rbp),%eax
40113f: 99 cltd
401140: b9 02 00 00 00 mov $0x2,%ecx
401145: f7 f9 idiv %ecx
401147: 83 fa 00 cmp $0x0,%edx
40114a: 0f 84 0f 00 00 00 je 40115f <main+0x4f>
401150: 6b 45 f8 03 imul $0x3,-0x8(%rbp),%eax
401154: 83 c0 01 add $0x1,%eax
401157: 89 45 f8 mov %eax,-0x8(%rbp)
40115a: e9 0e 00 00 00 jmpq 40116d <main+0x5d>
40115f: 8b 45 f8 mov -0x8(%rbp),%eax
401162: 99 cltd
401163: b9 02 00 00 00 mov $0x2,%ecx
401168: f7 f9 idiv %ecx
40116a: 89 45 f8 mov %eax,-0x8(%rbp)
40116d: e9 00 00 00 00 jmpq 401172 <main+0x62>
401172: e9 00 00 00 00 jmpq 401177 <main+0x67>
401177: b8 01 00 00 00 mov $0x1,%eax
40117c: 3b 45 f8 cmp -0x8(%rbp),%eax
40117f: 0f 85 9d ff ff ff jne 401122 <main+0x12>
401185: 8b 45 fc mov -0x4(%rbp),%eax
401188: 5d pop %rbp
401189: c3 retq
--
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/20200819/549bc40c/attachment-0001.html>
More information about the llvm-bugs
mailing list