1 // RUN: %clangxx_asan -m64 -O0 %s -o %t && ASAN_OPTIONS=strict_memcmp=0 %t 2>&1 | %symbolize | FileCheck %s --check-prefix=CHECK-nonstrict 2 // RUN: %clangxx_asan -m64 -O0 %s -o %t && ASAN_OPTIONS=strict_memcmp=1 %t 2>&1 | %symbolize | FileCheck %s --check-prefix=CHECK-strict 3 // Default to strict_memcmp=1. 4 // RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s --check-prefix=CHECK-strict 5 6 #include <stdio.h> 7 #include <string.h> 8 int main() { 9 char kFoo[] = "foo"; 10 char kFubar[] = "fubar"; 11 int res = memcmp(kFoo, kFubar, strlen(kFubar)); 12 printf("res: %d\n", res); 13 // CHECK-nonstrict: {{res: -1}} 14 // CHECK-strict: AddressSanitizer: stack-buffer-overflow 15 return 0; 16 } 17