https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121452
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- (In reply to Tobias Burnus from comment #1) > !$omp for ordered(2) > do i = 1, 5 > do j = 1, 5 Correction: 'for' → 'do', 'do i' → 'do 10 i' and 'do j' → 'do 20 j'. This one actually fails already in the front end: Error: !$OMP DO inner loops must be perfectly nested with ORDERED clause at (1) * * * Draft patch - seems to fix three examples in comment 0 + SPECaccel's 463.swim Todo: - Fix Fortran testcase of comment 1 (with fixes mentioned above) - check that it works - check that it doesn't prevent intended diagnostic - check whether there are other places where GIMPLE_OMP_STRUCTURED_BLOCK needs to be handled (missed diagnostic vs. bogus diagnostic) --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -3309,3 +3309,4 @@ check_omp_nesting_restrictions (gimple *stmt, omp_context || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE - || gimple_code (stmt) == GIMPLE_OMP_SCAN) + || gimple_code (stmt) == GIMPLE_OMP_SCAN + || gimple_code (stmt) == GIMPLE_OMP_STRUCTURED_BLOCK) return true; @@ -3339,3 +3340,4 @@ check_omp_nesting_restrictions (gimple *stmt, omp_context || gimple_omp_for_kind (stmt) != GF_OMP_FOR_KIND_SIMD) - && gimple_code (stmt) != GIMPLE_OMP_SCAN) + && gimple_code (stmt) != GIMPLE_OMP_SCAN + && gimple_code (stmt) != GIMPLE_OMP_STRUCTURED_BLOCK) {