https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95047
Bug ID: 95047 Summary: Wrong debug information for ternary operator at O0 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: massarelli at diag dot uniroma1.it Target Milestone: --- Debug information for ternary operator seems wrong at O0. $ 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 20200508 (experimental) (GCC) $ lldb -v lldb version 11.0.0 clang revision 23cbea9a04e023d5b79dfee5964fae769340c993 llvm revision 23cbea9a04e023d5b79dfee5964fae769340c993 $ cat a.c short a; short b( left, right ) { return ((left < 0) || (((int)right) < 0) || (((int)right) >= 32) || (left > ((32767) >> ((int)right)))) ? 0 : left ; } int main () { a = b(4294967286 , 5); } $ gcc -O0 -g a.c $ lldb a.out * thread #1, name = 'a.out', stop reason = breakpoint 2.1 frame #0: 0x00000000004004c1 unopt`main at a.c:13:9 10 } 11 int main () 12 { -> 13 a = b(4294967286 , 5); 14 } (lldb) s Process 78 stopped * thread #1, name = 'a.out', stop reason = step in frame #0: 0x000000000040048c unopt`b(left=-10, right=5) at a.c:7:7 4 { 5 return 6 ((left < 0) || (((int)right) < 0) || (((int)right) >= 32) || (left > ((32767) >> ((int)right)))) ? -> 7 0 : 8 left 9 ; 10 } (lldb) s Process 78 stopped * thread #1, name = 'a.out', stop reason = step in frame #0: 0x00000000004004bb unopt`b(left=-10, right=5) at a.c:10:1 7 0 : 8 left 9 ; -> 10 } 11 int main () 12 { 13 a = b(4294967286 , 5); (lldb) s Process 78 stopped * thread #1, name = 'a.out', stop reason = step in frame #0: 0x00000000004004d5 unopt`main at a.c:13:7 10 } 11 int main () 12 { -> 13 a = b(4294967286 , 5); 14 }