The stack is 16 byte aligned according to the ABI, but gcc assumes 32 byte alignment during register spilling write of function arguments (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. This should be enough, none of the other extended instruction sets uses 256 bit types.
Newer systems will use SHANI for SHA256 acceleration, older ones will fall back to one of the other (maybe a little slower) optimized implementations.
Upstream bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
Fixes #24726.