aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-low.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-12-12 08:36:02 +0100
committerJakub Jelinek <jakub@redhat.com>2020-12-12 08:36:02 +0100
commitcc9b9c0b68233d38a26f7acd68cc5f9a8fc4d994 (patch)
treea415eda93e0e270da9be7073af761a5a39809897 /gcc/omp-low.c
parent54f75d8fb3f54541e37432329581a362e6aab94e (diff)
downloadgcc-cc9b9c0b68233d38a26f7acd68cc5f9a8fc4d994.zip
gcc-cc9b9c0b68233d38a26f7acd68cc5f9a8fc4d994.tar.gz
gcc-cc9b9c0b68233d38a26f7acd68cc5f9a8fc4d994.tar.bz2
openmp, openacc: Fix up handling of data regions [PR98183]
While the data regions (target data and OpenACC counterparts) aren't standalone directives, unlike most other OpenMP/OpenACC constructs we allow (apparently as an extension) exceptions and goto out of the block. During gimplification we place an *end* call into a finally block so that it is reached even on exceptions or goto out etc.). During omplower pass we then add paired #pragma omp return for them, but due to the exceptions because the region is not SESE we can end up with #pragma omp return appearing only conditionally in the CFG etc., which the ompexp pass can't handle. For the ompexp pass, we actually don't care about the end part or about target data nesting, so we can treat it as standalone directive. 2020-12-12 Jakub Jelinek <jakub@redhat.com> PR middle-end/98183 * omp-low.c (lower_omp_target): Don't add OMP_RETURN for data regions. * omp-expand.c (expand_omp_target): Don't try to remove OMP_RETURN for data regions. (build_omp_regions_1, omp_make_gimple_edges): Don't expect OMP_RETURN for data regions. * gcc.dg/gomp/pr98183.c: New test. * gcc.dg/goacc/pr98183.c: New test.
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r--gcc/omp-low.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 09a8cbd..91a5e3d 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -12979,9 +12979,10 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
gimple_seq_add_seq (&new_body, join_seq);
if (offloaded)
- new_body = maybe_catch_exception (new_body);
-
- gimple_seq_add_stmt (&new_body, gimple_build_omp_return (false));
+ {
+ new_body = maybe_catch_exception (new_body);
+ gimple_seq_add_stmt (&new_body, gimple_build_omp_return (false));
+ }
gimple_omp_set_body (stmt, new_body);
}