Hello Stephen, hello Claude, following that previous idea of just replacing the aligned instruction with the unaligned one the hacky patch below got created, just replacing vmovapd by vmovupd. Not considering any side effects and maybe other instructions with alignment requirements. At least a mingw-w64 built with it builds an executable that would not crash in that situation. (Currentyl just meant as a proof of concept.) Maybe at least better than disabling AVX2 entirely?
Kind regards, Bernhard
--- a/src/gcc/config/i386/i386.md 2019-09-07 15:04:12.391156632 +0200 +++ b/src/gcc/config/i386/i386.md 2019-09-07 15:07:17.316822891 +0200 @@ -3521,9 +3521,9 @@ case MODE_V4SF: return "%vmovaps\t{%1, %0|%0, %1}"; case MODE_V8DF: - return "vmovapd\t{%g1, %g0|%g0, %g1}"; + return "vmovupd\t{%g1, %g0|%g0, %g1}"; case MODE_V2DF: - return "%vmovapd\t{%1, %0|%0, %1}"; + return "%vmovupd\t{%1, %0|%0, %1}"; case MODE_V2SF: gcc_assert (!TARGET_AVX); --- a/src/gcc/config/i386/sse.md 2019-09-07 15:04:12.399156531 +0200 +++ b/src/gcc/config/i386/sse.md 2019-09-07 15:07:09.420922575 +0200 @@ -1004,7 +1004,7 @@ return "vmovaps\t{%g1, %g0|%g0, %g1}"; case MODE_V4DF: case MODE_V2DF: - return "vmovapd\t{%g1, %g0|%g0, %g1}"; + return "vmovupd\t{%g1, %g0|%g0, %g1}"; case MODE_OI: case MODE_TI: return "vmovdqa64\t{%g1, %g0|%g0, %g1}"; @@ -1031,7 +1031,7 @@ || misaligned_operand (operands[1], <MODE>mode)) return "%vmovupd\t{%1, %0|%0, %1}"; else - return "%vmovapd\t{%1, %0|%0, %1}"; + return "%vmovupd\t{%1, %0|%0, %1}"; case MODE_OI: case MODE_TI: @@ -18952,11 +18952,11 @@ case MODE_V16SF: return "vmovaps\t{%1, %t0|%t0, %1}"; case MODE_V8DF: - return "vmovapd\t{%1, %t0|%t0, %1}"; + return "vmovupd\t{%1, %t0|%t0, %1}"; case MODE_V8SF: return "vmovaps\t{%1, %x0|%x0, %1}"; case MODE_V4DF: - return "vmovapd\t{%1, %x0|%x0, %1}"; + return "vmovupd\t{%1, %x0|%x0, %1}"; case MODE_XI: if (which_alternative == 2) return "vmovdqa\t{%1, %t0|%t0, %1}";