Skip to content

Commit fc9b4e8

Browse files
committed
build: Disable AVX2 code path on mingw builds
The stack is 16 byte aligned according to the ABI, but gcc assumes 32 byte alignment during register spilling (doesn't re-align the stack pointer), resulting in ~50% chance of a crash. Avoid this issue by disabling detection of AVX2 compiler support when compiling with mingw-w64. Upstream bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412 Fixes #24726.
1 parent 1021e4c commit fc9b4e8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

configure.ac

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,12 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
554554
#include <stdint.h>
555555
#include <immintrin.h>
556556
]],[[
557+
#ifdef __MINGW64__
558+
#error AVX2 is disabled in Windows gcc builds (see https://github.com/bitcoin/bitcoin/issues/24726).
559+
#else
557560
__m256i l = _mm256_set1_epi32(0);
558561
return _mm256_extract_epi32(l, 7);
562+
#endif
559563
]])],
560564
[ AC_MSG_RESULT([yes]); enable_avx2=yes; AC_DEFINE([ENABLE_AVX2], [1], [Define this symbol to build code that uses AVX2 intrinsics]) ],
561565
[ AC_MSG_RESULT([no])]

0 commit comments

Comments
 (0)