diff options
author | Jakub Jelinek <jakub@redhat.com> | 2009-07-28 18:15:47 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2009-07-28 18:15:47 +0200 |
commit | 394a5b34b1c35ef8aae0b6c177a770408d4a7649 (patch) | |
tree | 26883979ecfe7f394d5821662e84767466896612 | |
parent | fa4d0418e4926467ac7c8e3c81c246ecf284da5d (diff) | |
download | gcc-394a5b34b1c35ef8aae0b6c177a770408d4a7649.zip gcc-394a5b34b1c35ef8aae0b6c177a770408d4a7649.tar.gz gcc-394a5b34b1c35ef8aae0b6c177a770408d4a7649.tar.bz2 |
re PR fortran/40878 (!$omp collapse(m) with non-constant m should give error)
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.
From-SVN: r150165
-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 ea622e5..623c601 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 608d605..320fb65 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 2899b3a..ac5dc98 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 0000000..86202ab --- /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 0000000..a118aa8 --- /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 |