33 lines · cpp
1// RUN: %clang_cl_asan %Od %s %Fe%t2// RUN: %env_asan_opts=handle_sigfpe=1 not %run %t 2>&1 | FileCheck %s3 4// FIXME: On MinGW frame #0 does not include the line number?5// XFAIL: target={{.*-windows-gnu}}6// XFAIL: msvc7 8// Test the error output from misaligned SSE2 memory access. This is a READ9// memory access. Windows appears to always provide an address of -1 for these10// types of faults, and there doesn't seem to be a way to distinguish them from11// 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((__m128i *)buffer);19 __m128i b = _mm_load_si128((__m128i *)(&buffer[0] + 1));20 return _mm_or_si128(a, b);21}22 23int main() {24 puts("before alignment fault");25 fflush(stdout);26 volatile __m128i v = test();27 return 0;28}29// CHECK: before alignment fault30// 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