https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96854
Bug ID: 96854 Summary: avx vectorizer breaks complex arithmetic Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: already5chosen at yahoo dot com Target Milestone: --- '-Ofast -mavx -march=ivybridge' miscompiles this simple loop: double complex foo(double complex acc, const double complex *x, const double complex* y, int N) { for (int c = 0; c < N; ++c) acc -= x[c] * y[c]; return acc; } The bug appears to be triggered by -fassociative-math, but it could be a trigger rather than the reason. You can find a reproducer here: https://github.com/already5chosen/others/tree/master/cholesky_solver/gcc-bug I only tried with MSYS2 variant of gcc 10.2.0