1 // Clang doesn't support SEH on Windows yet, so for the time being we
2 // build this program in two parts: the code with SEH is built with CL,
3 // the rest is built with Clang. This represents the typical scenario when we
4 // build a large project using "clang-cl -fallback -fsanitize=address".
6 // FIXME: Investigate why -GS- is required.
7 // RUN: cl -GS- -c %s -Fo%t.obj
8 // RUN: %clangxx_asan -o %t.exe %s %t.obj
15 // Should just "#include <sanitizer/asan_interface.h>" when C++ exceptions are
16 // supported and we don't need to use CL.
17 extern "C" bool __asan_address_is_poisoned(void *p
);
21 #if !defined(__clang__)
25 fprintf(stderr
, "Throw: %p\n", &local
);
30 void ThrowAndCatch() {
34 } __except(EXCEPTION_EXECUTE_HANDLER
) {
35 fprintf(stderr
, "__except: %p\n", &local
);
42 fprintf(stderr
, "Before: %p poisoned: %d\n", &x
,
43 __asan_address_is_poisoned(x
+ 32));
44 assert(__asan_address_is_poisoned(x
+ 32));
46 fprintf(stderr
, "After: %p poisoned: %d\n", &x
,
47 __asan_address_is_poisoned(x
+ 32));
48 // FIXME: Invert this assertion once we fix
49 // https://code.google.com/p/address-sanitizer/issues/detail?id=258
50 assert(!__asan_address_is_poisoned(x
+ 32));