]> gcc.gnu.org Git - gcc.git/commit
openmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]
authorJakub Jelinek <jakub@redhat.com>
Sat, 24 Sep 2022 07:24:26 +0000 (09:24 +0200)
committerJakub Jelinek <jakub@redhat.com>
Wed, 3 May 2023 11:30:46 +0000 (13:30 +0200)
commit8629045a50bbc37d25fe9203c810a96ef96ef0f7
tree85a213a28f6c74982ff8d096789195f50ead0eba
parent7cdefaee48af5d203560091bd37aad206df683b9
openmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]

The following testcase ICEs because with -O0 -fexceptions GOMP_taskgroup_end
call isn't directly followed by GOMP_RETURN statement, but there are some
conditionals to handle exceptions and we fail to find the correct GOMP_RETURN.

The fix is to treat taskgroup similarly to target data, both of these constructs
emit a try { body } finally { end_call } around the construct's body during
gimplification and we need to see proper construct nesting during gimplification
and omp lowering (including nesting of regions checks), but during omp expansion
we don't really need their nesting anymore, all we need is emit something at
the start of the region and the end of the region is the end API call we've
already emitted during gimplification.  For target data, we weren't adding
GOMP_RETURN statement during omp lowering, so after that pass it is treated
merely like stand-alone omp directives.  This patch does the same for
taskgroup too.

2022-09-24  Jakub Jelinek  <jakub@redhat.com>

PR c/107001
* omp-low.c (lower_omp_taskgroup): Don't add GOMP_RETURN statement
at the end.
* omp-expand.c (build_omp_regions_1): Clarify GF_OMP_TARGET_KIND_DATA
is not stand-alone directive.  For GIMPLE_OMP_TASKGROUP, also don't
update parent.
(omp_make_gimple_edges) <case GIMPLE_OMP_TASKGROUP>: Reset
cur_region back after new_omp_region.

* c-c++-common/gomp/pr107001.c: New test.

(cherry picked from commit ad2aab5c816a6fd56b46210c0a4a4c6243da1de9)
gcc/omp-expand.c
gcc/omp-low.c
gcc/testsuite/c-c++-common/gomp/pr107001.c [new file with mode: 0644]
This page took 0.058576 seconds and 6 git commands to generate.