1// RUN: %clang_cl_asan %Od %s %Fe%t
2// RUN: %env_asan_opts=handle_sigfpe=1 not %run %t 2>&1 | FileCheck %s
3
4// FIXME: On MinGW frame #0 does not include the line number?
5// XFAIL: target={{.*-windows-gnu}}
6
7// Test the error output from misaligned SSE2 memory access. This is a READ
8// memory access. Windows appears to always provide an address of -1 for these
9// types of faults, and there doesn't seem to be a way to distinguish them from
10// other types of access violations without disassembling.
11
12#include <emmintrin.h>
13#include <stdio.h>
14
15__m128i test() {
16 char buffer[17] = {};
17 __m128i a = _mm_load_si128(p: (__m128i *)buffer);
18 __m128i b = _mm_load_si128(p: (__m128i *)(&buffer[0] + 1));
19 return _mm_or_si128(a: a, b: b);
20}
21
22int main() {
23 puts(s: "before alignment fault");
24 fflush(stdout);
25 volatile __m128i v = test();
26 return 0;
27}
28// CHECK: before alignment fault
29// CHECK: ERROR: AddressSanitizer: access-violation on unknown address {{0x[fF]*}}
30// CHECK-NEXT: The signal is caused by a READ memory access.
31// CHECK-NEXT: #0 {{.*}} in test({{(void)?}}) {{.*}}misalignment.cpp:{{.*}}
32

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