On 08/11/2016 09:26 AM, Thomas Schwinge wrote: > As Cesar asked for it, there is now a Git branch > tschwinge/omp/pr72741-wip containing these changes (plus some other > pending changes that I didn't single out at this time), at > . > (I expect it does, but I didn't verify that this actually builds; I have > further changes on top of that.) Cesar, please tell me if you'd like me > to push this to GitHub, in case you want to use their review/commentary > functions, or the like. No, that git repository is fine. > On Thu, 11 Aug 2016 17:40:26 +0200, Jakub Jelinek wrote: >> On Thu, Aug 11, 2016 at 05:18:43PM +0200, Thomas Schwinge wrote: >>> --- gcc/fortran/gfortran.h >>> +++ gcc/fortran/gfortran.h > >>> /* Symbol attribute structure. */ >>> -typedef struct >>> +typedef struct symbol_attribute >>> { > >> While symbol_attribute is already bloated, I don't like bloating it this >> much further. Do you really need it for all symbols, or just all subroutines? > > Certainly not for all symbole; just for what is valid to be used with the > OpenACC routine directive, which per OpenACC 2.0a, 2.13.1 Routine > Directive is: > > In Fortran the syntax of the routine directive is: > !$acc routine clause-list > !$acc routine( name ) clause-list > In Fortran, the routine directive without a name may appear within the specification part of a subroutine or function definition, or within an interface body for a subroutine or function in an interface block, and applies to the containing subroutine or function. The routine directive with a name may appear in the specification part of a subroutine, function or module, and applies to the named subroutine or function. > > (Pasting that in full just in case that contains some additional Fortran > lingo, meaning more than "subroutines".) I'm avoided that problem in this patch. For the moment, I'm ignoring the device_type problem and handling all of the matching errors in gfc_match_oacc_routine. You're patch was handling those errors in add_attributes_to_decls, which I think is too late. device_type will require extra handling down the road. But instead of introducing new attributes, we can just use the existing gfc_oacc_routine_name struct to capture and chain all of the clauses for all of the different device_types. Then we can teach add_attributes_to_decls to call gfc_oacc_routine_dims to generate the appropriate OACC_FUNCTION attribute for a given set of device_type clauses. Note that besides for checking for multiple acc routine directives, this patch also handles the case where the optional name argument in 'acc routine (NAME)' is the name of the current procedure. This was a TODO item in gomp4. Thomas, does this patch ok to you for gomp4? Cesar