From e5fd6684b9577e822997ceedabfeaa7d61722fe2 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 28 Feb 2019 21:31:23 +0100 Subject: [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 From-SVN: r269286 --- gcc/fortran/openmp.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'gcc/fortran/openmp.c') 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. */ -- cgit v1.1