]> git.ipfire.org Git - thirdparty/gcc.git/commit
libgomp: Fix up creation of artificial teams
authorJakub Jelinek <jakub@redhat.com>
Wed, 12 Oct 2022 15:54:08 +0000 (17:54 +0200)
committerJakub Jelinek <jakub@redhat.com>
Wed, 12 Oct 2022 15:54:08 +0000 (17:54 +0200)
commita58a965eb73253759f6a3e1c7380392557da89c8
tree1cdb86eba60f2ed367dd254e1c8886187d727db3
parent9bf74082bc93226e1ceb66430706e957e460c841
libgomp: Fix up creation of artificial teams

When not in explicit parallel/target/teams construct, we in some cases create
an artificial parallel with a single thread (either to handle target nowait
or for task reduction purposes).  In those cases, it handled again artificially
created implicit task (created by gomp_new_icv for cases where we needed to write
to some ICVs), but as the testcases show, didn't take into account possibility
of this being done from explicit task(s).  The code would destroy/free the previous
task and replace it with the new implicit task.  If task is an explicit task
(when teams is NULL, all explicit tasks behave like if (0)), it is a pointer to
a local stack variable, so freeing it doesn't work, and additionally we shouldn't
lose the explicit tasks - the new implicit task should instead replace the
ancestor task which is the first implicit one.

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

* task.c (gomp_create_artificial_team): Fix up handling of invocations
from within explicit task.
* target.c (GOMP_target_ext): Likewise.
* testsuite/libgomp.c/task-7.c: New test.
* testsuite/libgomp.c/task-8.c: New test.
* testsuite/libgomp.c-c++-common/task-reduction-17.c: New test.
* testsuite/libgomp.c-c++-common/task-reduction-18.c: New test.
libgomp/target.c
libgomp/task.c
libgomp/testsuite/libgomp.c-c++-common/task-reduction-17.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c-c++-common/task-reduction-18.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/task-7.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/task-8.c [new file with mode: 0644]