Skip to content
Snippets Groups Projects
Commit 86a4af27 authored by Jakub Jelinek's avatar Jakub Jelinek Committed by Jakub Jelinek
Browse files

openmp: Fix handling of declare target statics with array type which need destruction [PR118876]

The following testcase ICEs because it attempts to emit the __tcfa function twice,
once when handling the host destruction and once when handling nohost destruction.

This patch fixes it by using __omp_tcfa function for the nohost case and marks it
with the needed "omp declare target" and "omp declare target nohost" attributes.

2025-02-25  Jakub Jelinek  <jakub@redhat.com>

	PR c++/118876
	* cp-tree.h (register_dtor_fn): Add a bool argument defaulted to false.
	* decl.cc (start_cleanup_fn): Add OMP_TARGET argument, use
	"__omp_tcf" prefix rather than "__tcf" in that case.  Add
	"omp declare target" and "omp declare target nohost" attributes
	to the fndecl.
	(register_dtor_fn): Add OMP_TARGET argument, pass it down to
	start_cleanup_fn.
	* decl2.cc (one_static_initialization_or_destruction): Add OMP_TARGET
	argument, pass it down to register_dtor_fn.
	(emit_partial_init_fini_fn): Pass omp_target to
	one_static_initialization_or_destruction.
	(handle_tls_init): Pass false to
	one_static_initialization_or_destruction.

	* g++.dg/gomp/pr118876.C: New test.
parent a41b3f54
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment