[Bug debug/95047] Wrong debug information for ternary operator at O0

massarelli at diag dot uniroma1.it gcc-bugzilla@gcc.gnu.org
Mon May 11 07:42:32 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95047

--- Comment #2 from Luca Massarelli <massarelli at diag dot uniroma1.it> ---
Ok, so it seems that there is an inconsistency with -Og:

$ gcc -Og -g -o opt a.c

$ lldb opt
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x00000000004004bb opt`main at a.c:13:9
   10   }
   11   int main ()
   12   {
-> 13       a = b(4294967286 , 5);
   14   }
(lldb) s
Process 101 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x0000000000400482 opt`b(left=-10, right=5) at a.c:6:12
   3    b( left,  right )
   4    {
   5      return
-> 6        ((left < 0) || (((int)right) < 0) || (((int)right) >= 32) || (left
> ((32767) >> ((int)right)))) ?
   7        0 :
   8        left
   9    ;
(lldb) s
Process 101 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x0000000000400490 opt`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 101 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x00000000004004cf opt`main at a.c:13:7
   10   }
   11   int main ()
   12   {
-> 13       a = b(4294967286 , 5);
   14   }


More information about the Gcc-bugs mailing list