https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118876

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:86a4af2793393e47af6b78cb7094c97914890091

commit r15-7691-g86a4af2793393e47af6b78cb7094c97914890091
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Feb 25 09:29:39 2025 +0100

    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  <ja...@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.

Reply via email to