1 // XFAIL:*
2 //// Currently debug info for 'local' behaves, but 'plocal' dereferences to
3 //// the incorrect value 0xFF after the call to esc.
4 
5 // REQUIRES: lldb
6 // UNSUPPORTED: system-windows
7 // RUN: %dexter --fail-lt 1.0 -w --debugger lldb \
8 // RUN:     --builder clang-c --cflags "-O2 -glldb" -- %s
9 //
10 //// Check that a pointer to a variable living on the stack dereferences to the
11 //// variable value.
12 
13 int glob;
14 __attribute__((__noinline__))
esc(int * p)15 void esc(int* p) {
16   glob = *p;
17   *p = 0xFF;
18 }
19 
main()20 int main() {
21   int local = 0xA;
22   int *plocal = &local;
23   esc(plocal);      // DexLabel('s1')
24   local = 0xB;      //// DSE
25   return 0;         // DexLabel('s2')
26 }
27 
28 
29 // DexExpectWatchValue('local', 0xA, on_line='s1')
30 // DexExpectWatchValue('local', 0xB, on_line='s2')
31 // DexExpectWatchValue('*plocal', 0xA, on_line='s1')
32 // DexExpectWatchValue('*plocal', 0xB, on_line='s2')
33 //// Ideally we should be able to observe the dead store to local (0xB) through
34 //// plocal here.
35 // DexExpectWatchValue('(local == *plocal)', 'true', from_line='s1', to_line='s2')
36