Last active
February 1, 2020 22:54
-
-
Save serge-rgb/e9e80ebe18e3cc902f83a214caa14891 to your computer and use it in GitHub Desktop.
clang-cl.exe crash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <intrin.h> | |
int | |
main() | |
{ | |
__m128i var = {}; | |
// Create an unaligned _m128i pointer. | |
__m128i* elem = (__m128i*) ( (char*)malloc(sizeof(__m128i) + 1) + 1 ); | |
*elem = var; // Will crash on Windows 10 x64 with clang-cl.exe LLVM 9.0 | |
/** | |
cl.exe generates (rax holds the elem pointer): | |
movdqa xmm0,xmmword ptr [var] | |
movdqu xmmword ptr [rax],xmm0 | |
clang-cl.exe generates: | |
movdqa xmmword ptr [rax],xmm0 | |
which traps, since movdqa requires memory destinations to be 16-byte aligned. | |
**/ | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment