diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2019-02-28 21:31:23 +0100 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gcc.gnu.org> | 2019-02-28 21:31:23 +0100 |
commit | e5fd6684b9577e822997ceedabfeaa7d61722fe2 (patch) | |
tree | a9ce3a476a0cc9f399634c7fe84677a40a285410 /gcc/fortran | |
parent | 6f87db2d7823ff70eca4fa76950aafe8a98d7356 (diff) | |
download | gcc-e5fd6684b9577e822997ceedabfeaa7d61722fe2.zip gcc-e5fd6684b9577e822997ceedabfeaa7d61722fe2.tar.gz gcc-e5fd6684b9577e822997ceedabfeaa7d61722fe2.tar.bz2 |
[PR72741] For all Fortran OpenACC 'routine' directive variants check for multiple clauses specifying the level of parallelism
gcc/fortran/
PR fortran/72741
* gfortran.h (enum oacc_routine_lop): Add OACC_ROUTINE_LOP_ERROR.
* openmp.c (gfc_oacc_routine_lop, gfc_match_oacc_routine): Use it.
* trans-decl.c (add_attributes_to_decl): Likewise.
gcc/testsuite/
PR fortran/72741
* gfortran.dg/goacc/routine-multiple-lop-clauses-1.f90: New file.
Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>
From-SVN: r269286
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/gfortran.h | 3 | ||||
-rw-r--r-- | gcc/fortran/openmp.c | 13 | ||||
-rw-r--r-- | gcc/fortran/trans-decl.c | 1 |
4 files changed, 18 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 78c6324..1c8f712 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -2,6 +2,11 @@ Cesar Philippidis <cesar@codesourcery.com> PR fortran/72741 + * gfortran.h (enum oacc_routine_lop): Add OACC_ROUTINE_LOP_ERROR. + * openmp.c (gfc_oacc_routine_lop, gfc_match_oacc_routine): Use it. + * trans-decl.c (add_attributes_to_decl): Likewise. + + PR fortran/72741 PR fortran/89433 * openmp.c (gfc_match_oacc_routine): Accept intrinsic symbols. diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index f0258b3..3e0f634 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -323,7 +323,8 @@ enum oacc_routine_lop OACC_ROUTINE_LOP_GANG, OACC_ROUTINE_LOP_WORKER, OACC_ROUTINE_LOP_VECTOR, - OACC_ROUTINE_LOP_SEQ + OACC_ROUTINE_LOP_SEQ, + OACC_ROUTINE_LOP_ERROR }; /* Strings for all symbol attributes. We use these for dumping the diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 6999ac3..50b91f2 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -2265,7 +2265,7 @@ gfc_oacc_routine_lop (gfc_omp_clauses *clauses) } if (n_lop_clauses > 1) - gfc_error ("Multiple loop axes specified for routine"); + ret = OACC_ROUTINE_LOP_ERROR; } return ret; @@ -2280,6 +2280,7 @@ gfc_match_oacc_routine (void) gfc_symbol *sym = NULL; gfc_omp_clauses *c = NULL; gfc_oacc_routine_name *n = NULL; + oacc_routine_lop lop = OACC_ROUTINE_LOP_NONE; old_loc = gfc_current_locus; @@ -2352,6 +2353,13 @@ gfc_match_oacc_routine (void) != MATCH_YES)) return MATCH_ERROR; + lop = gfc_oacc_routine_lop (c); + if (lop == OACC_ROUTINE_LOP_ERROR) + { + gfc_error ("Multiple loop axes specified for routine at %C"); + goto cleanup; + } + if (isym != NULL) { /* Diagnose any OpenACC 'routine' directive that doesn't match the @@ -2381,8 +2389,7 @@ gfc_match_oacc_routine (void) gfc_current_ns->proc_name->name, &old_loc)) goto cleanup; - gfc_current_ns->proc_name->attr.oacc_routine_lop - = gfc_oacc_routine_lop (c); + gfc_current_ns->proc_name->attr.oacc_routine_lop = lop; } else /* Something has gone wrong, possibly a syntax error. */ diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 20d4530..36b7fdd 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1425,6 +1425,7 @@ add_attributes_to_decl (symbol_attribute sym_attr, tree list) code = OMP_CLAUSE_SEQ; break; case OACC_ROUTINE_LOP_NONE: + case OACC_ROUTINE_LOP_ERROR: default: gcc_unreachable (); } |