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