https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60997
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Also, the compiler really isn't allowed to interchange the !$OMP DO loop (outermost) with the inner ones, it has different semantics because of the markup. The compiler could still interchange the inner two loops if it is beneficial. You can also try to use collapse(2) or collapse(3) clause on the !$OMP DO, then the outermost two or all 3 loops are workshared together.