Charlie Barto 73114e43ee
[compiler-rt][windows] Test fixups for MSVC. (#109887)
- add XFAIL/UNSUPPORTED annotations for tests run wtih real MSVC 
- macroify usages of clang-specific attributes in asan tests

- Add substitution for /Oy-/-fno-omit-frame-pointer
  This makes the dll_intercept_memset test work with mingw

These are most of the changes that are required to get things running
with MSVC, however there are some remaining build-flag tweaks.

Nothing in here should be a functional change.
2025-02-10 10:51:08 -08:00

29 lines
794 B
C++

// Repro for the issue #64990: Asan with Windows EH generates __asan_xxx runtime calls without required funclet tokens
// RUN: %clang_cl_asan %Od %if MSVC %{ /Oi %} %s -EHsc %Fe%t
// RUN: not %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: target={{.*-windows-gnu}}
#if defined(_MSC_VER) && !defined(__clang__)
# include <string.h>
#endif
char buff1[6] = "hello";
char buff2[6] = "hello";
int main(int argc, char **argv) {
try {
throw 1;
} catch (...) {
// Make asan generate call to __asan_memcpy inside the EH pad.
#if defined(_MSC_VER) && !defined(__clang__)
memcpy(buff1, buff2 + 3, 6);
#else
__builtin_memcpy(buff1, buff2 + 3, 6);
#endif
}
return 0;
}
// CHECK: #0 {{.*}} in __asan_memcpy
// CHECK: SUMMARY: AddressSanitizer: global-buffer-overflow {{.*}} in main