]> git.ipfire.org Git - thirdparty/gcc.git/commit
openmp: Copy DECL_LANG_SPECIFIC and DECL_LANG_FLAG_? to tree-nested decl copy [PR114825]
authorJakub Jelinek <jakub@redhat.com>
Thu, 25 Apr 2024 18:09:35 +0000 (20:09 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 20 Jun 2024 13:07:41 +0000 (15:07 +0200)
commit0ff2aad2f7242fffa646d06b3da7d28191e1c788
treee45f891ac9f49e043258915539a481623c2402ae
parent1fc4a915c797d3a98a327dfc546948c5879336e0
openmp: Copy DECL_LANG_SPECIFIC and DECL_LANG_FLAG_? to tree-nested decl copy [PR114825]

tree-nested.cc creates in 2 spots artificial VAR_DECLs, one of them is used
both for debug info and OpenMP/OpenACC lowering purposes, the other solely for
OpenMP/OpenACC lowering purposes.
When the decls are used in OpenMP/OpenACC lowering, the OMP langhooks (mostly
Fortran, C just a little and C++ doesn't have nested functions) then inspect
the flags on the vars and based on that decide how to lower the corresponding
clauses.

Unfortunately we weren't copying DECL_LANG_SPECIFIC and DECL_LANG_FLAG_?, so
the langhooks made decisions on the default flags on those instead.
As the original decl isn't necessarily a VAR_DECL, could be e.g. PARM_DECL,
using copy_node wouldn't work properly, so this patch just copies those
flags in addition to other flags it was copying already.  And I've removed
code duplication by introducing a helper function which does copying common
to both uses.

2024-04-25  Jakub Jelinek  <jakub@redhat.com>

PR fortran/114825
* tree-nested.c (get_debug_decl): New function.
(get_nonlocal_debug_decl): Use it.
(get_local_debug_decl): Likewise.

* gfortran.dg/gomp/pr114825.f90: New test.

(cherry picked from commit 14d48516e588ad2b35e2007b3970bdcb1b3f145c)
gcc/testsuite/gfortran.dg/gomp/pr114825.f90 [new file with mode: 0644]
gcc/tree-nested.c