diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-28 16:15:47 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-28 16:15:47 +0000 |
commit | 7a8903e38e10230655967d79eb297f8d36720594 (patch) | |
tree | 26883979ecfe7f394d5821662e84767466896612 | |
parent | 293a4f4c698179c20288c944c1bfbd36c4719dbd (diff) | |
download | ppe42-gcc-7a8903e38e10230655967d79eb297f8d36720594.tar.gz ppe42-gcc-7a8903e38e10230655967d79eb297f8d36720594.zip |
PR fortran/40878
* openmp.c (gfc_match_omp_clauses): Use gfc_error_now instead of
gfc_error to diagnose invalid COLLAPSE arguments.
* gfortran.dg/gomp/pr40878-1.f90: New test.
* gfortran.dg/gomp/pr40878-2.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150165 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/openmp.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/gomp/pr40878-1.f90 | 63 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/gomp/pr40878-2.f90 | 23 |
5 files changed, 99 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ea622e565bf..623c601c173 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +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 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 608d605c951..320fb65c97c 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -396,12 +396,13 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, int mask) 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2899b3a4d00..ac5dc98973f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 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. diff --git a/gcc/testsuite/gfortran.dg/gomp/pr40878-1.f90 b/gcc/testsuite/gfortran.dg/gomp/pr40878-1.f90 new file mode 100644 index 00000000000..86202ab5d0e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr40878-1.f90 @@ -0,0 +1,63 @@ +! 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 diff --git a/gcc/testsuite/gfortran.dg/gomp/pr40878-2.f90 b/gcc/testsuite/gfortran.dg/gomp/pr40878-2.f90 new file mode 100644 index 00000000000..a118aa86025 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr40878-2.f90 @@ -0,0 +1,23 @@ +! 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 |