From 68034b1bc2058fd3c78b0f583e718e8443346580 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 22 Feb 2019 11:50:35 +0100 Subject: [PR72741] Use 'oacc_build_routine_dims' for Fortran OpenACC 'routine' directives, too ... instead of having an incomplete local implementation. With these changes in place, we can then also revert the work-around r267213 "[nvptx] Unify C/Fortran routine handling in nvptx_goacc_validate_dims". gcc/fortran/ PR fortran/72741 * gfortran.h (oacc_routine_lop): New enum. (symbol_attribute): Use it. * openmp.c (gfc_oacc_routine_dims): Replace with... (gfc_oacc_routine_lop): ... this new function. (gfc_match_oacc_routine): Adjust. * trans-decl.c (add_attributes_to_decl): Likewise. gcc/ PR fortran/72741 * omp-general.c (oacc_replace_fn_attrib): Mostly split out into... (oacc_replace_fn_attrib_attr): ... this new function. * omp-general.h (oacc_replace_fn_attrib_attr): New prototype. * config/nvptx/nvptx.c (nvptx_goacc_validate_dims_1): Revert workaround. gcc/testsuite/ PR fortran/72741 * gfortran.dg/goacc/classify-routine.f95: Adjust. Co-Authored-By: Cesar Philippidis From-SVN: r269105 --- gcc/omp-general.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'gcc/omp-general.c') diff --git a/gcc/omp-general.c b/gcc/omp-general.c index 0f66ba0..356772f 100644 --- a/gcc/omp-general.c +++ b/gcc/omp-general.c @@ -540,16 +540,26 @@ oacc_launch_pack (unsigned code, tree device, unsigned op) /* Replace any existing oacc fn attribute with updated dimensions. */ -void -oacc_replace_fn_attrib (tree fn, tree dims) +/* Variant working on a list of attributes. */ + +tree +oacc_replace_fn_attrib_attr (tree attribs, tree dims) { tree ident = get_identifier (OACC_FN_ATTRIB); - tree attribs = DECL_ATTRIBUTES (fn); /* If we happen to be present as the first attrib, drop it. */ if (attribs && TREE_PURPOSE (attribs) == ident) attribs = TREE_CHAIN (attribs); - DECL_ATTRIBUTES (fn) = tree_cons (ident, dims, attribs); + return tree_cons (ident, dims, attribs); +} + +/* Variant working on a function decl. */ + +void +oacc_replace_fn_attrib (tree fn, tree dims) +{ + DECL_ATTRIBUTES (fn) + = oacc_replace_fn_attrib_attr (DECL_ATTRIBUTES (fn), dims); } /* Scan CLAUSES for launch dimensions and attach them to the oacc -- cgit v1.1