From 24f80aa404d41a79214e6c67cc0076664eb110b9 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 10 Apr 2018 16:04:37 +0200 Subject: [PATCH] re PR fortran/85313 (gcc/fortran/openmp.c: 2 * confused logic ?) PR fortran/85313 * openmp.c (resolve_omp_do): Remove bogus if (j < i) break;. (resolve_oacc_nested_loops): Likewise. Formatting fix. * gfortran.dg/gomp/pr85313.f90: New test. From-SVN: r259275 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/openmp.c | 8 ++----- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/gomp/pr85313.f90 | 25 ++++++++++++++++++++++ 4 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/gomp/pr85313.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 53792eb25d8..75d0a7e8d1f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-04-10 Jakub Jelinek + + PR fortran/85313 + * openmp.c (resolve_omp_do): Remove bogus if (j < i) break;. + (resolve_oacc_nested_loops): Likewise. Formatting fix. + 2018-04-09 Thomas Koenig PR fortran/83064 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 5a14925bb61..be80f8dea24 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -5600,8 +5600,6 @@ resolve_omp_do (gfc_code *code) "iteration space at %L", name, &do_code->loc); break; } - if (j < i) - break; do_code2 = do_code2->block->next; } } @@ -5765,12 +5763,10 @@ resolve_oacc_nested_loops (gfc_code *code, gfc_code* do_code, int collapse, || gfc_find_sym_in_expr (ivar, do_code->ext.iterator->end) || gfc_find_sym_in_expr (ivar, do_code->ext.iterator->step)) { - gfc_error ("!$ACC LOOP %s loops don't form rectangular iteration space at %L", - clause, &do_code->loc); + gfc_error ("!$ACC LOOP %s loops don't form rectangular " + "iteration space at %L", clause, &do_code->loc); break; } - if (j < i) - break; do_code2 = do_code2->block->next; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 80ad244e3e6..302fd9845fc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-04-10 Jakub Jelinek + + PR fortran/85313 + * gfortran.dg/gomp/pr85313.f90: New test. + 2018-04-10 Paolo Carlini PR c++/24314 diff --git a/gcc/testsuite/gfortran.dg/gomp/pr85313.f90 b/gcc/testsuite/gfortran.dg/gomp/pr85313.f90 new file mode 100644 index 00000000000..04599849ed7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr85313.f90 @@ -0,0 +1,25 @@ +! PR fortran/85313 +! { dg-do compile } + +!$omp do collapse(3) + do i = 1, 10 + do j = i, 20 ! { dg-error "form rectangular iteration space" } + do k = 1, 2 + end do + end do + end do +!$omp do collapse(3) + do i = 1, 10 + do j = 1, 5 + do k = i, 20 ! { dg-error "form rectangular iteration space" } + end do + end do + end do +!$omp do collapse(3) + do i = 1, 10 + do j = 1, 5 + do k = j, 20 ! { dg-error "form rectangular iteration space" } + end do + end do + end do +end -- 2.30.2