]> gcc.gnu.org Git - 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, 9 May 2024 04:26:08 +0000 (06:26 +0200)
commit6d30cfc3fc88976151d0d10e73e10111ccb71ee0
tree07e0a230c0a2d83a3c2afa470edf0a89f3c105fe
parentf1b1d515aa5836844cdb45e8bb2b941784f78fd2
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.cc (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.cc
This page took 0.066364 seconds and 6 git commands to generate.