+2009-07-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/40878
+ * openmp.c (gfc_match_omp_clauses): Use gfc_error_now instead of
+ gfc_error to diagnose invalid COLLAPSE arguments.
+
2009-07-28 Janus Weil <janus@gcc.gnu.org>
PR fortran/40882
const char *p = gfc_extract_int (cexpr, &collapse);
if (p)
{
- gfc_error (p);
+ gfc_error_now (p);
collapse = 1;
}
else if (collapse <= 0)
{
- gfc_error ("COLLAPSE clause argument not constant positive integer at %C");
+ gfc_error_now ("COLLAPSE clause argument not"
+ " constant positive integer at %C");
collapse = 1;
}
c->collapse = collapse;
2009-07-28 Jakub Jelinek <jakub@redhat.com>
+ PR fortran/40878
+ * gfortran.dg/gomp/pr40878-1.f90: New test.
+ * gfortran.dg/gomp/pr40878-2.f90: New test.
+
PR testsuite/40891
* gcc.dg/cdce1.c: Adjust note line number.
* gcc.dg/cdce2.c: Likewise.
--- /dev/null
+! PR fortran/40878
+! { dg-do compile }
+! { dg-options "-fopenmp" }
+
+subroutine test1
+ integer :: j, k
+ integer :: m = 2
+!$omp parallel do collapse(m) schedule (static,1) ! { dg-error "Constant expression required" }
+ do k = 1, 2
+ do j = 1, 6
+ enddo
+ enddo
+!$omp end parallel do
+end
+subroutine test2
+ integer :: j, k
+ integer :: m
+ m = 2
+!$omp parallel do collapse(m) schedule (static,1) ! { dg-error "Constant expression required" }
+ do k = 1, 2
+ do j = 1, 6
+ enddo
+ enddo
+!$omp end parallel do
+end
+subroutine test3
+ integer :: j, k
+ integer, parameter :: m = 0
+!$omp parallel do collapse(m) schedule (static,1) ! { dg-error "not constant positive integer" }
+ do k = 1, 2
+ do j = 1, 6
+ enddo
+ enddo
+!$omp end parallel do
+end
+subroutine test4
+ integer :: j, k
+ integer, parameter :: m = -2
+!$omp parallel do collapse(m) schedule (static,1) ! { dg-error "not constant positive integer" }
+ do k = 1, 2
+ do j = 1, 6
+ enddo
+ enddo
+!$omp end parallel do
+end
+subroutine test5
+ integer :: j, k
+!$omp parallel do collapse(0) schedule (static,1) ! { dg-error "not constant positive integer" }
+ do k = 1, 2
+ do j = 1, 6
+ enddo
+ enddo
+!$omp end parallel do
+end
+subroutine test6
+ integer :: j, k
+!$omp parallel do collapse(-1) schedule (static,1) ! { dg-error "not constant positive integer" }
+ do k = 1, 2
+ do j = 1, 6
+ enddo
+ enddo
+!$omp end parallel do
+end
--- /dev/null
+! PR fortran/40878
+! { dg-do compile }
+! { dg-options "-fopenmp" }
+
+subroutine test1
+ integer :: j, k
+ integer, parameter :: m = 2
+!$omp parallel do collapse(m) schedule (static,1)
+ do k = 1, 2
+ do j = 1, 6
+ enddo
+ enddo
+!$omp end parallel do
+end
+subroutine test2
+ integer :: j, k
+!$omp parallel do collapse(2) schedule (static,1)
+ do k = 1, 2
+ do j = 1, 6
+ enddo
+ enddo
+!$omp end parallel do
+end