diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-04-06 23:36:44 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-04-06 23:36:44 +0000 |
commit | 4eefd0a197018ec6400c78f53970900e4b17d74e (patch) | |
tree | 2dcbccf5cd40dcd3d3fa71607ea42566c07554c2 /debuginfo-tests | |
parent | d8209dc510f643d85e220068c874d5acbb0b63f2 (diff) |
Add an end-to-end testcase for address sanitizer.
Diffstat (limited to 'debuginfo-tests')
-rw-r--r-- | debuginfo-tests/asan.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/debuginfo-tests/asan.c b/debuginfo-tests/asan.c new file mode 100644 index 00000000000..44cfe5027a3 --- /dev/null +++ b/debuginfo-tests/asan.c @@ -0,0 +1,23 @@ +// RUN: %clang %target_itanium_abi_host_triple -arch x86_64 %s -o %t.out -g -fsanitize=address +// RUN: %test_debuginfo %s %t.out +// +// DEBUGGER: break 21 +// DEBUGGER: r +// DEBUGGER: p s +// +// CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7) + +struct S { + int a[8]; +}; + +int f(struct S s, unsigned i) { + return s.a[i]; +} + +int main(int argc, const char **argv) { + struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}}; + if (f(s, 4) == 4) + return f(s, 0); + return 0; +} |