From f016ee89955ab4da5fe7ef89368e9437bb5ffb13 Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Tue, 25 Mar 2025 15:55:45 +0000 Subject: OpenMP: Create additional interop objects with append_args. This patch adds support for the case where #pragma omp declare variant with append_args is used inside a #pragma omp dispatch interop that specifies fewer interop args than required by the variant; new interop objects are implicitly created and then destroyed around the call to the variant, using the GOMP_interop builtin. gcc/fortran/ChangeLog * trans-openmp.cc (gfc_trans_omp_declare_variant): Remove accidental redeclaration of pref. gcc/ChangeLog * gimplify.cc (modify_call_for_omp_dispatch): Adjust arguments. Remove the "sorry" for the case where new interop objects must be constructed, and add code to make it work instead. (expand_variant_call_expr): Adjust arguments and call to modify_call_for_omp_dispatch. (gimplify_variant_call_expr): Simplify logic for calling expand_variant_call_expr. gcc/testsuite/ChangeLog * c-c++-common/gomp/append-args-1.c: Adjust expected behavior. * c-c++-common/gomp/append-args-interop.c: New. * c-c++-common/gomp/dispatch-11.c: Adjust expected behavior. * g++.dg/gomp/append-args-1.C: Likewise. * gfortran.dg/gomp/append-args-interop.f90: New. * gfortran.dg/gomp/declare-variant-mod-2.f90: Adjust expected behavior. libgomp/ChangeLog * libgomp.texi (OpenMP 5.1): Mark append_args as fully supported. Co-Authored-By: Tobias Burnus --- gcc/fortran/trans-openmp.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index bf8c341..03d9432 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -8980,8 +8980,8 @@ gfc_trans_omp_declare_variant (gfc_namespace *ns, gfc_namespace *parent_ns) tree pref = NULL_TREE; if (n->u.init.len) { - tree pref = build_string (n->u.init.len, - n->u2.init_interop); + pref = build_string (n->u.init.len, + n->u2.init_interop); TREE_TYPE (pref) = build_array_type_nelts ( unsigned_char_type_node, n->u.init.len); -- cgit v1.1