1 // RUN: %clangxx_asan -O %s -o %t
2 // RUN: not %t crash 2>&1 | FileCheck --check-prefix=CHECK-CRASH %s
3 // RUN: not %t bad-bounds 2>&1 | FileCheck --check-prefix=CHECK-BAD %s
4 // Test crash due to __sanitizer_annotate_contiguous_container.
10 void __sanitizer_annotate_contiguous_container(const void *beg
, const void *end
,
15 static volatile int one
= 1;
19 __sanitizer_annotate_contiguous_container(&t
[0], &t
[0] + 100, &t
[0] + 100,
21 return (int)t
[60 * one
]; // Touches the poisoned memory.
26 __sanitizer_annotate_contiguous_container(&t
[0], &t
[0] + 100, &t
[0] + 101,
30 int main(int argc
, char **argv
) {
32 if (!strcmp(argv
[1], "crash"))
34 else if (!strcmp(argv
[1], "bad-bounds"))
37 // CHECK-CRASH: AddressSanitizer: container-overflow
38 // CHECK-BAD: ERROR: AddressSanitizer: bad parameters to __sanitizer_annotate_contiguous_container