1// Repro for the issue #64990: Asan with Windows EH generates __asan_xxx runtime calls without required funclet tokens
2// RUN: %clang_cl_asan %Od %if MSVC %{ /Oi %} %s -EHsc %Fe%t
3// RUN: not %run %t 2>&1 | FileCheck %s
4
5// UNSUPPORTED: target={{.*-windows-gnu}}
6
7#if defined(_MSC_VER) && !defined(__clang__)
8# include <string.h>
9#endif
10
11char buff1[6] = "hello";
12char buff2[6] = "hello";
13
14int main(int argc, char **argv) {
15 try {
16 throw 1;
17 } catch (...) {
18 // Make asan generate call to __asan_memcpy inside the EH pad.
19#if defined(_MSC_VER) && !defined(__clang__)
20 memcpy(buff1, buff2 + 3, 6);
21#else
22 __builtin_memcpy(buff1, buff2 + 3, 6);
23#endif
24 }
25 return 0;
26}
27// CHECK: #0 {{.*}} in __asan_memcpy
28// CHECK: SUMMARY: AddressSanitizer: global-buffer-overflow {{.*}} in main
29

Provided by KDAB

Privacy Policy
Update your C++ knowledge – Modern C++11/14/17 Training
Find out more

source code of compiler-rt/test/asan/TestCases/Windows/issue64990.cpp