1 // RUN: %clangxx_asan -O %s -o %t
2 // RUN: not %run %t crash 2>&1 | FileCheck --check-prefix=CHECK-CRASH %s
3 // RUN: not %run %t bad-bounds 2>&1 | FileCheck --check-prefix=CHECK-BAD-BOUNDS %s
4 // RUN: not %run %t bad-alignment 2>&1 | FileCheck --check-prefix=CHECK-BAD-ALIGNMENT %s
5 // RUN: %env_asan_opts=detect_container_overflow=0 %run %t crash
7 // Test crash due to __sanitizer_annotate_contiguous_container.
13 void __sanitizer_annotate_contiguous_container(const void *beg, const void *end,
18 static volatile int one = 1;
23 __sanitizer_annotate_contiguous_container(&t[0], &t[0] + 100, &t[0] + 100,
25 // CHECK-CRASH: AddressSanitizer: container-overflow
26 return (int)t[60 * one]; // Touches the poisoned memory.
31 // CHECK-BAD-BOUNDS: ERROR: AddressSanitizer: bad parameters to __sanitizer_annotate_contiguous_container
32 __sanitizer_annotate_contiguous_container(&t[0], &t[0] + 100, &t[0] + 101,
38 // CHECK-BAD-ALIGNMENT: ERROR: AddressSanitizer: bad parameters to __sanitizer_annotate_contiguous_container
39 // CHECK-BAD-ALIGNMENT: ERROR: beg is not aligned by 8
40 __sanitizer_annotate_contiguous_container(&t[1], &t[0] + 100, &t[1] + 10,
44 int main(int argc, char **argv) {
46 if (!strcmp(argv[1], "crash"))
48 else if (!strcmp(argv[1], "bad-bounds"))
50 else if (!strcmp(argv[1], "bad-alignment"))