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

            Bug ID: 51941
           Summary: Variable's value late availability after Instruction
                    Selection at O3
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected],
                    [email protected]

A variable (l_33) value is visile after its declarations, then its not visible
anymore after a next command and comes back in after another next command.
>From opt-bisect, it seems that the pass after which this behaviour occurs is:
X86 DAG->DAG Instruction Selection on function (main)

$ cat a.c
short a;
int b ;
int main() 
  {
    {int l_33 = 0;
      int *c = &l_33;
      *c = a 
        ;
        *c ^= 2
        ;
        b = l_33 ;
      }
  }

$ clang -v
clang version 13.0.0
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
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

$ lldb -v
lldb version 13.0.0

$ clang -g -O3 -o opt a.c
$ lldb opt
(lldb) target create "opt"
Current executable set to
'/home/stepping/debuginfo-analysis/issues/issue14/opt' (x86_64).
(lldb) b main
Breakpoint 1: where = opt`main at a.c:7:12, address = 0x0000000000400480
(lldb) run
Process 28 launched: '/home/stepping/debuginfo-analysis/issues/issue14/opt'
(x86_64)
Process 28 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400480 opt`main at a.c:7:12
   4      {
   5        {int l_33 = 0;
   6          int *c = &l_33;
-> 7          *c = a 
   8            ;
   9            *c ^= 2
   10           ;
(lldb) frame var 
(int) l_33 = 0
(int *) c = <no location, value may have been optimized out>

(lldb) n
Process 28 stopped
* thread #1, name = 'opt', stop reason = step over
    frame #0: 0x0000000000400487 opt`main at a.c:9:12
   6          int *c = &l_33;
   7          *c = a 
   8            ;
-> 9            *c ^= 2
   10           ;
   11           b = l_33 ;
   12         }
(lldb) frame var
(int) l_33 = <variable not available>
(int *) c = <no location, value may have been optimized out>

(lldb) n
Process 28 stopped
* thread #1, name = 'opt', stop reason = step over
    frame #0: 0x000000000040048a opt`main at a.c:11:11
   8            ;
   9            *c ^= 2
   10           ;
-> 11           b = l_33 ;
   12         }
   13     }
(lldb) frame var
(int) l_33 = 2
(int *) c = <no location, value may have been optimized out>

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to