aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/openmp.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2020-10-22 17:09:22 +0200
committerTobias Burnus <tobias@codesourcery.com>2020-10-22 17:09:22 +0200
commitc26d7df103197e52dcd6edbb9a7f58eafdd6c715 (patch)
tree612b26bcbe24f27385ef93fa3bda30b2f90f4276 /gcc/fortran/openmp.c
parentb69c00612db1ccf7de77b0072c6b1b47090318f3 (diff)
downloadgcc-c26d7df103197e52dcd6edbb9a7f58eafdd6c715.zip
gcc-c26d7df103197e52dcd6edbb9a7f58eafdd6c715.tar.gz
gcc-c26d7df103197e52dcd6edbb9a7f58eafdd6c715.tar.bz2
OpenMP: Fortran - support omp flush's memorder clauses
gcc/fortran/ChangeLog: * gfortran.h (enum gfc_omp_memorder): Add. (gfc_omp_clauses): Use it. * openmp.c (gfc_match_omp_flush): Match memorder clauses. * trans-openmp.c (gfc_trans_omp_flush): Handle them. (gfc_trans_omp_directive): Update call. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/flush-1.f90: New test. * gfortran.dg/gomp/flush-2.f90: New test.
Diffstat (limited to 'gcc/fortran/openmp.c')
-rw-r--r--gcc/fortran/openmp.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 1efce33..b143ba7 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -2766,15 +2766,44 @@ match
gfc_match_omp_flush (void)
{
gfc_omp_namelist *list = NULL;
+ gfc_omp_clauses *c = NULL;
+ gfc_gobble_whitespace ();
+ enum gfc_omp_memorder mo = OMP_MEMORDER_LAST;
+ if (gfc_match_omp_eos () == MATCH_NO && gfc_peek_ascii_char () != '(')
+ {
+ if (gfc_match ("acq_rel") == MATCH_YES)
+ mo = OMP_MEMORDER_ACQ_REL;
+ else if (gfc_match ("release") == MATCH_YES)
+ mo = OMP_MEMORDER_RELEASE;
+ else if (gfc_match ("acquire") == MATCH_YES)
+ mo = OMP_MEMORDER_ACQUIRE;
+ else
+ {
+ gfc_error ("Expected AQC_REL, RELEASE, or ACQUIRE at %C");
+ return MATCH_ERROR;
+ }
+ c = gfc_get_omp_clauses ();
+ c->memorder = mo;
+ }
gfc_match_omp_variable_list (" (", &list, true);
+ if (list && mo != OMP_MEMORDER_LAST)
+ {
+ gfc_error ("List specified together with memory order clause in FLUSH "
+ "directive at %C");
+ gfc_free_omp_namelist (list);
+ gfc_free_omp_clauses (c);
+ return MATCH_ERROR;
+ }
if (gfc_match_omp_eos () != MATCH_YES)
{
gfc_error ("Unexpected junk after $OMP FLUSH statement at %C");
gfc_free_omp_namelist (list);
+ gfc_free_omp_clauses (c);
return MATCH_ERROR;
}
new_st.op = EXEC_OMP_FLUSH;
new_st.ext.omp_namelist = list;
+ new_st.ext.omp_clauses = c;
return MATCH_YES;
}