Hi! To allow me to progress with other work items, is the attached "OpenACC: Support GCC/C++-special 'default(_GCC_firstprivate)' clause [PR119692]" OK to push to trunk branch, with a few test cases added?
(I might also suggest OpenACC 'default(firstprivate)' for standardization by the OpenACC Technical Committee.) Grüße Thomas
>From 660ffe85a98e9f0ec6ddd6ba1f383a44b672502c Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tschwi...@baylibre.com> Date: Wed, 9 Apr 2025 17:35:42 +0200 Subject: [PATCH] OpenACC: Support GCC/C++-special 'default(_GCC_firstprivate)' clause [PR119692] ... provide an OpenACC work-around, while PR119692 "C++ 'typeinfo', 'vtable' vs. OpenACC, OpenMP 'target' offloading" is not yet resolved. This is similar in spirit to OpenMP 'default(firstprivate)'. PR c++/119692 gcc/cp/ * parser.cc (cp_parser_omp_clause_default): For OpenACC, support 'default(_GCC_firstprivate)' clause. gcc/ * gimplify.cc (oacc_default_clause): Handle 'OMP_CLAUSE_DEFAULT_FIRSTPRIVATE'. --- gcc/cp/parser.cc | 6 ++++++ gcc/gimplify.cc | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 812a7c5ae7d..169783c5caf 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -39886,6 +39886,12 @@ cp_parser_omp_clause_default (cp_parser *parser, tree list, switch (p[0]) { + case '_': + if (strcmp ("_GCC_firstprivate", p) != 0 || !is_oacc) + goto invalid_kind; + kind = OMP_CLAUSE_DEFAULT_FIRSTPRIVATE; + break; + case 'n': if (strcmp ("none", p) != 0) goto invalid_kind; diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index e90220cc2a0..9ab2e10037a 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -8966,6 +8966,9 @@ oacc_default_clause (struct gimplify_omp_ctx *ctx, tree decl, unsigned flags) if (RECORD_OR_UNION_TYPE_P (type)) is_private = lang_hooks.decls.omp_disregard_value_expr (decl, false); + if (ctx_default->default_kind == OMP_CLAUSE_DEFAULT_FIRSTPRIVATE) + is_private = true; + if ((ctx->region_type & (ORT_ACC_PARALLEL | ORT_ACC_KERNELS)) != 0 && is_global_var (decl) && device_resident_p (decl) @@ -9034,7 +9037,8 @@ oacc_default_clause (struct gimplify_omp_ctx *ctx, tree decl, unsigned flags) oacc_region_type_name (ctx_default->region_type), "default(none)"); } - else if (ctx_default->default_kind == OMP_CLAUSE_DEFAULT_PRESENT) + else if (ctx_default->default_kind == OMP_CLAUSE_DEFAULT_PRESENT + || ctx_default->default_kind == OMP_CLAUSE_DEFAULT_FIRSTPRIVATE) ; /* Handled above. */ else gcc_checking_assert (ctx_default->default_kind == OMP_CLAUSE_DEFAULT_SHARED); -- 2.34.1