Make test more lenient for custom clang version strings
[llvm-project.git] / compiler-rt / test / asan / TestCases / strcspn-2.c
bloba51fb911e8025304cbd94451969fc0b6dd6cabe5
1 // Test stopset overflow in strcspn function
2 // RUN: %clang_asan %s -o %t && %env_asan_opts=strict_string_checks=true not %run %t 2>&1 | FileCheck %s
4 // Test intercept_strcspn asan option
5 // RUN: %env_asan_opts=intercept_strspn=false %run %t 2>&1
7 #include <assert.h>
8 #include <string.h>
9 #include <sanitizer/asan_interface.h>
11 int main(int argc, char **argv) {
12 size_t r;
13 char s1[] = "ab";
14 char s2[4] = "abc";
15 __asan_poison_memory_region ((char *)&s2[2], 2);
16 r = strcspn(s1, s2);
17 // CHECK:'s2'{{.*}} <== Memory access at offset {{[0-9]+}} partially overflows this variable
18 assert(r == 0);
19 return 0;