re PR middle-end/65431 (Invalid read of size 8 at 0x105DBBF8: delete_omp_context...
authorJakub Jelinek <jakub@redhat.com>
Mon, 16 Mar 2015 16:10:17 +0000 (17:10 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 16 Mar 2015 16:10:17 +0000 (17:10 +0100)
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.

From-SVN: r221459

gcc/ChangeLog
gcc/omp-low.c

index 93281881db96197ad70428c5a79b3018a3f1b0f9..6af257e434bf844d8ae9db52cea6c9b163cb2fef 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2015-03-16  Max Ostapenko  <m.ostapenko@partner.samsung.com>
 
        PR sanitizer/64820
index 2d64a74e3eaf89c46b9e859ee624c98d292f6521..1ecc6f8b7bd0e250f667044db51fe8c9203be6f1 100644 (file)
@@ -1580,10 +1580,12 @@ delete_omp_context (splay_tree_value value)
     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