1 // RUN: %clang_cl_asan %Od %s %Fe%t
2 // RUN: %run %t | FileCheck %s
4 // This is a test for http://code.google.com/p/address-sanitizer/issues/detail?id=305
8 typedef void (*FPTR
)();
10 // __xi_a and __xi_z are defined in VC/crt/src/crt0dat.c
11 // and are located in .CRT$XIA and .CRT$XIZ respectively.
12 extern "C" FPTR __xi_a
, __xi_z
;
17 // Iterate through CRT initializers.
18 for (FPTR
* it
= &__xi_a
; it
< &__xi_z
; ++it
) {
23 printf("Number of nonzero CRT initializers: %u\n", count
);
24 // CHECK: Number of nonzero CRT initializers
27 void call_me_maybe() {}
29 #pragma data_seg(".CRT$XIB")
30 // Add an initializer that shouldn't get its own redzone.
31 FPTR run_on_startup
= call_me_maybe
;