1673dc3d4SNico Weber // RUN: %clang_cl_asan -Od %s -Fe%t 2673dc3d4SNico Weber // RUN: not %run %t 2>&1 | FileCheck %s 3673dc3d4SNico Weber 4673dc3d4SNico Weber #include <windows.h> 5673dc3d4SNico Weber #include <stdio.h> 6673dc3d4SNico Weber 7673dc3d4SNico Weber extern "C" const char *foo = "foobarspam"; 8673dc3d4SNico Weber main(void)9673dc3d4SNico Weberint main(void) { 10673dc3d4SNico Weber if (foo[16]) 11673dc3d4SNico Weber printf("Boo\n"); 12673dc3d4SNico Weber // CHECK-NOT: Boo 13673dc3d4SNico Weber // CHECK: AddressSanitizer: global-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] 14673dc3d4SNico Weber // CHECK: READ of size 1 at [[ADDR]] thread T0 15673dc3d4SNico Weber // CHECK-NEXT: {{#0 .* main .*global_const_string_oob.cpp:}}[[@LINE-5]] 16*13e9c1d1SMitch Phillips // CHECK: [[ADDR]] is located 5 bytes to the right of global variable [[STR:.*]] defined in {{'.*global_const_string_oob.cpp' .*}} of size 11 17673dc3d4SNico Weber // CHECK: [[STR]] is ascii string 'foobarspam' 18673dc3d4SNico Weber return 0; 19673dc3d4SNico Weber } 20673dc3d4SNico Weber 21