https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105950
--- Comment #30 from John Kanapes <jkanapes at yahoo dot com> --- I checked without the -mavx2 option, and it worked with -O3 optimization, even with gcc 9.4.0:) It seems that whatever problem is related to that option. Have you tried it with -mavx2 option in 9.5 and 12.1?