From f7ba880b6b4b1c9d7437889204cac5df0268d158 Mon Sep 17 00:00:00 2001 From: Cesar Philippidis Date: Fri, 15 Jul 2016 07:03:35 -0700 Subject: [PATCH] openmp.c (gfc_match_omp_clauses): Scan for clause vector_length before vector. gcc/fortran/ * openmp.c (gfc_match_omp_clauses): Scan for clause vector_length before vector. gcc/testsuite/ * gfortran.dg/goacc/vector_length.f90: New test. From-SVN: r238375 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/openmp.c | 12 +++++++----- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/goacc/vector_length.f90 | 11 +++++++++++ 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/goacc/vector_length.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 22ca4f4e488..51e8e2e55ef 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2016-07-15 Cesar Philippidis + + * openmp.c (gfc_match_omp_clauses): Scan for clause vector_length + before vector. + 2016-07-15 Andre Vehreschild PR fortran/71807 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 865e0d9d5f0..9fff9942057 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -1338,6 +1338,13 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, uint64_t mask, continue; break; case 'v': + /* VECTOR_LENGTH must be matched before VECTOR, because the latter + doesn't unconditionally match '('. */ + if ((mask & OMP_CLAUSE_VECTOR_LENGTH) + && c->vector_length_expr == NULL + && (gfc_match ("vector_length ( %e )", &c->vector_length_expr) + == MATCH_YES)) + continue; if ((mask & OMP_CLAUSE_VECTOR) && !c->vector && gfc_match ("vector") == MATCH_YES) @@ -1353,11 +1360,6 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, uint64_t mask, needs_space = true; continue; } - if ((mask & OMP_CLAUSE_VECTOR_LENGTH) - && c->vector_length_expr == NULL - && (gfc_match ("vector_length ( %e )", &c->vector_length_expr) - == MATCH_YES)) - continue; break; case 'w': if ((mask & OMP_CLAUSE_WAIT) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c3a56007ac0..2a6ca3f2bc0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-07-15 Cesar Philippidis + + * gfortran.dg/goacc/vector_length.f90: New test. + 2016-07-15 Richard Biener PR tree-optimization/71881 diff --git a/gcc/testsuite/gfortran.dg/goacc/vector_length.f90 b/gcc/testsuite/gfortran.dg/goacc/vector_length.f90 new file mode 100644 index 00000000000..ddab9cfd8c1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/vector_length.f90 @@ -0,0 +1,11 @@ +program t + implicit none + integer, parameter :: n = 100 + integer a(n), i + + !$acc parallel loop num_gangs(100) num_workers(1) vector_length(32) + do i = 1, n + a(i) = i + enddo + !$acc end parallel loop +end program t -- 2.30.2