brintos

brintos / llvm-project-archived public Read only

0
0
Text · 794 B · 5222ec6 Raw
29 lines · cpp
1// Repro for the issue #64990: Asan with Windows EH generates __asan_xxx runtime calls without required funclet tokens2// RUN: %clang_cl_asan %Od %if MSVC %{ /Oi %} %s -EHsc %Fe%t3// RUN: not %run %t 2>&1 | FileCheck %s4 5// UNSUPPORTED: target={{.*-windows-gnu}}6 7#if defined(_MSC_VER) && !defined(__clang__)8#  include <string.h>9#endif10 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#else22    __builtin_memcpy(buff1, buff2 + 3, 6);23#endif24  }25  return 0;26}27// CHECK: #0 {{.*}} in __asan_memcpy28// CHECK: SUMMARY: AddressSanitizer: global-buffer-overflow {{.*}} in main29