aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorCesar Philippidis <cesar@codesourcery.com>2016-07-15 07:03:35 -0700
committerCesar Philippidis <cesar@gcc.gnu.org>2016-07-15 07:03:35 -0700
commitf7ba880b6b4b1c9d7437889204cac5df0268d158 (patch)
tree6399b623b5ba4e0e6d923ae4a28cddb0dbd4c7b5 /gcc
parentb9aba0a05820874b01e67264a02494d5d8d27309 (diff)
downloadgcc-f7ba880b6b4b1c9d7437889204cac5df0268d158.zip
gcc-f7ba880b6b4b1c9d7437889204cac5df0268d158.tar.gz
gcc-f7ba880b6b4b1c9d7437889204cac5df0268d158.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/openmp.c12
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/vector_length.f9011
4 files changed, 27 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 22ca4f4..51e8e2e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2016-07-15 Cesar Philippidis <cesar@codesourcery.com>
+
+ * openmp.c (gfc_match_omp_clauses): Scan for clause vector_length
+ before vector.
+
2016-07-15 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/71807
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 865e0d9..9fff994 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 c3a5600..2a6ca3f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2016-07-15 Cesar Philippidis <cesar@codesourcery.com>
+
+ * gfortran.dg/goacc/vector_length.f90: New test.
+
2016-07-15 Richard Biener <rguenther@suse.de>
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 0000000..ddab9cf
--- /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