re PR fortran/85313 (gcc/fortran/openmp.c: 2 * confused logic ?)
authorJakub Jelinek <jakub@redhat.com>
Tue, 10 Apr 2018 14:04:37 +0000 (16:04 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 10 Apr 2018 14:04:37 +0000 (16:04 +0200)
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
gcc/fortran/openmp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr85313.f90 [new file with mode: 0644]

index 53792eb25d8013aa49f4fdda9d5d2302b60f3b5a..75d0a7e8d1fc81869378326f13dd7cd990f7bfd3 100644 (file)
@@ -1,3 +1,9 @@
+2018-04-10  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <tkoenig@gcc.gnu.org>
 
        PR fortran/83064
index 5a14925bb61a5e68c4037f8ffdc44fbde571dab4..be80f8dea24ffc56c2ce38cbd3ad048270f44ae3 100644 (file)
@@ -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;
            }
        }
index 80ad244e3e642a770465e6f58d233780f1522209..302fd9845fcc5780337a03f68d2ef2798fea7afa 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/85313
+       * gfortran.dg/gomp/pr85313.f90: New test.
+
 2018-04-10  Paolo Carlini  <paolo.carlini@oracle.com>
 
        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 (file)
index 0000000..0459984
--- /dev/null
@@ -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