[LVI] Add trunc to i1 handling. (#124480)
[llvm-project.git] / compiler-rt / test / asan / TestCases / Windows / crt_initializers.cpp
blob5a1eee33e7011194028a9ab3f40f6f077d8ad10c
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
6 #include <stdio.h>
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;
14 int main() {
15 unsigned count = 0;
17 // Iterate through CRT initializers.
18 for (FPTR* it = &__xi_a; it < &__xi_z; ++it) {
19 if (*it)
20 count++;
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;