[committed] Fix reduction_map destruction (PR middle-end/65431)
Jakub Jelinek
jakub@redhat.com
Mon Mar 16 16:16:00 GMT 2015
Hi!
Trying to access *ctx->outer in delete_omp_context, which is called from
splay tree deletion and thus it is pretty much random if the outer context
is destructed before or after the child, is a very bad idea.
It seems a unique splay tree is assigned to ctx->reduction_map only for
the offloading openacc GIMPLE_OMP_TARGET constructs, so this patch deletes
them on those contexts only and no other contexts.
Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.
2015-03-16 Jakub Jelinek <jakub@redhat.com>
PR middle-end/65431
* omp-low.c (delete_omp_context): Only splay_tree_delete
reduction_map in GIMPLE_OMP_TARGET is_gimple_omp_offloaded
is_gimple_omp_oacc contexts. Don't look at ctx->outer.
--- gcc/omp-low.c.jj 2015-03-12 09:49:16.000000000 +0100
+++ gcc/omp-low.c 2015-03-16 10:18:35.082465483 +0100
@@ -1580,10 +1580,12 @@ delete_omp_context (splay_tree_value val
splay_tree_delete (ctx->field_map);
if (ctx->sfield_map)
splay_tree_delete (ctx->sfield_map);
+ /* Reduction map is copied to nested contexts, so only delete it in the
+ owner. */
if (ctx->reduction_map
- /* Shared over several omp_contexts. */
- && (ctx->outer == NULL
- || ctx->reduction_map != ctx->outer->reduction_map))
+ && gimple_code (ctx->stmt) == GIMPLE_OMP_TARGET
+ && is_gimple_omp_offloaded (ctx->stmt)
+ && is_gimple_omp_oacc (ctx->stmt))
splay_tree_delete (ctx->reduction_map);
/* We hijacked DECL_ABSTRACT_ORIGIN earlier. We need to clear it before
Jakub
More information about the Gcc-patches
mailing list