]> git.ipfire.org Git - thirdparty/gcc.git/commit
openmp: Don't try to destruct DECL_OMP_PRIVATIZED_MEMBER vars [PR108180]
authorJakub Jelinek <jakub@redhat.com>
Wed, 21 Dec 2022 08:05:27 +0000 (09:05 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 3 May 2023 11:49:31 +0000 (13:49 +0200)
commit2a8357535300e9d4d6126d7b3ce4cd951f0eb6aa
treef7eeabb86d119447bd3f271c7a7620a012c92f01
parent39cac73d73962bc7623fa6f9bc138ed291b964c8
openmp: Don't try to destruct DECL_OMP_PRIVATIZED_MEMBER vars [PR108180]

DECL_OMP_PRIVATIZED_MEMBER vars are artificial vars with DECL_VALUE_EXPR
of this->field used just during gimplification and omp lowering/expansion
to privatize individual fields in methods when needed.
As the following testcase shows, when not in templates, they were handled
right, but in templates we actually called cp_finish_decl on them and
that can result in their destruction, which is obviously undesirable,
we should only destruct the privatized copies of them created in omp
lowering.

Fixed thusly.

2022-12-21  Jakub Jelinek  <jakub@redhat.com>

PR c++/108180
* pt.c (tsubst_expr): Don't call cp_finish_decl on
DECL_OMP_PRIVATIZED_MEMBER vars.

* testsuite/libgomp.c++/pr108180.C: New test.

(cherry picked from commit 1119902b6c7c1c50123ed85ec1def8be4772d68c)
gcc/cp/pt.c
libgomp/testsuite/libgomp.c++/pr108180.C [new file with mode: 0644]