https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72741
--- Comment #3 from Thomas Schwinge <tschwinge at gcc dot gnu.org> --- Created attachment 39064 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39064&action=edit Fortran routine directive with a name Cesar, thanks for your initial fix. Please have a look at the new file I'm attaching. Clearly, the two OpenACC routine directives are conflicting; this illustrates my earlier point 'from a quick look it seems as if for a routine directive with a name (such as: "!$acc routine (function_1) gang"), any clauses specified are generally not evaluated to determine the specified function's level of parallelism'. No compiler diagnostic is being created for that. Instead of fixing just that specific problem only, please (also) verify and implement my following ideas (separate patch?). In early parsing in the front end, do not check for routine dimension errors (we can't do that anyway, if you take the device_type clause into account). That is, remove gcc/fortran/openmp.c:gfc_oacc_routine_dims. Instead of the "dims" you compute from the clauses in gcc/fortran/openmp.c:gfc_match_oacc_routine and save in attr.oacc_function, just store all clauses (gfc_omp_clauses) in that "attr". If that is not feasible (I don't know how "attr" is processed in the following, also regarding Fortran modules etc.), then have "attr" contain *separate* members for all clauses that apply to the OpenACC routine directive: gang, worker, vector, seq, bind, nohost. Then, move the "multiple loop axes" checking into gcc/fortran/trans-decl.c:add_attributes_to_decl. As this function has access to all gfc_omp_clauses corresponding to the decl (or, at least all individual OpenACC routine clauses), this should then ideally just call gcc/fortran/trans-openmp.c:gfc_trans_omp_clauses to translate the Fortran OMP clauses representation into OMP_CLAUSE trees. (Notice that on gomp-4_0-branch, gcc/fortran/trans-decl.c:add_attributes_to_decl already contains some incomplete, ad-hoc code to handle the nohost clause; you can ignore that stuff for the moment -- if you put the infrastructure in place for the clauses specifying the level of parallelism, we can then later add bind/nohost handling.) Instead of the manual "oacc function" attribute construction, then call gcc/omp-low.c:build_oacc_routine_dims and gcc/omp-low.c:replace_oacc_fn_attrib, as I had commented earlier.