1// RUN: %clang_cl_asan %Od %s %Fe%t
2// RUN: %env_asan_opts=handle_sigill=1 not %run %t 2>&1 | FileCheck %s
3// msvc doesn't have a __builtin_trap equivalent
4// XFAIL: msvc
5
6// Test the error output from an illegal instruction.
7
8#include <stdio.h>
9
10int main() {
11 puts(s: "before ud2a");
12 fflush(stdout);
13 __builtin_trap();
14 return 0;
15}
16// CHECK: before ud2a
17// CHECK: ERROR: AddressSanitizer: illegal-instruction on unknown address [[ADDR:0x[^ ]*]]
18// CHECK-SAME: (pc [[ADDR]] {{.*}})
19// CHECK-NEXT: #0 {{.*}} in main {{.*}}illegal_instruction.cpp:{{.*}}
20

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

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