xref: /llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/asan.c (revision 45a40c163932d12b72b33bd1d8a84519392b5d39)
1 // REQUIRES: !asan, compiler-rt, lldb
2 // UNSUPPORTED: system-windows
3 //           Zorg configures the ASAN stage2 bots to not build the asan
4 //           compiler-rt. Only run this test on non-asanified configurations.
5 //
6 // RUN: %clang -std=gnu11 --driver-mode=gcc -O0 -glldb -fblocks -arch x86_64 \
7 // RUN:     -fsanitize=address %s -o %t
8 // RUN: %dexter --fail-lt 1.0 -w \
9 // RUN:     --binary %t --debugger 'lldb' -- %s
10 
11 struct S {
12   int a[8];
13 };
14 
f(struct S s,unsigned i)15 int f(struct S s, unsigned i) {
16   return s.a[i]; // DexLabel('asan')
17 }
18 
main(int argc,const char ** argv)19 int main(int argc, const char **argv) {
20   struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};
21   if (f(s, 4) == 4)
22     return f(s, 0);
23   return 0;
24 }
25 
26 // DexExpectWatchValue('s.a[0]', '0', on_line=ref('asan'))
27 // DexExpectWatchValue('s.a[1]', '1', on_line=ref('asan'))
28 // DexExpectWatchValue('s.a[7]', '7', on_line=ref('asan'))
29 
30