- _mm256_load_si256(&in[i * 4 + 0]),
- _mm256_load_si256(&in[i * 4 + 1])), kWeightScaleBits);
+
+ #if defined(__MINGW32__) || defined(__MINGW64__)
+ // HACK: Use _mm256_loadu_si256() instead of _mm256_load_si256. Because the binary
+ // compiled with g++ in MSYS2 crashes here because the output memory is not aligned
+ // even though alignas is specified.
+ _mm256_loadu_si256
+ #else
+ _mm256_load_si256
+ #endif
+
+ (&in[i * 4 + 0]),
+
+ #if defined(__MINGW32__) || defined(__MINGW64__)
+ _mm256_loadu_si256
+ #else
+ _mm256_load_si256
+ #endif
+
+ (&in[i * 4 + 1])), kWeightScaleBits);