public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r10-10681] openmp: Make finalize_task_copyfn order reproduceable [PR104517]
Date: Tue, 10 May 2022 08:24:02 +0000 (GMT)	[thread overview]
Message-ID: <20220510082402.49103383602B@sourceware.org> (raw)

https://gcc.gnu.org/g:d028f4313ae55837b30bec6b737c92a229b4f23d

commit r10-10681-gd028f4313ae55837b30bec6b737c92a229b4f23d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Feb 15 10:22:30 2022 +0100

    openmp: Make finalize_task_copyfn order reproduceable [PR104517]
    
    The following testcase fails -fcompare-debug, because finalize_task_copyfn
    was invoked from splay tree destruction, whose order can in some cases
    depend on -g/-g0.  The fix is to queue the task stmts that need copyfn
    in a vector and run finalize_task_copyfn on elements of that vector.
    
    2022-02-15  Jakub Jelinek  <jakub@redhat.com>
    
            PR debug/104517
            * omp-low.c (task_cpyfns): New variable.
            (delete_omp_context): Don't call finalize_task_copyfn from here.
            (create_task_copyfn): Push task_stmt into task_cpyfns.
            (execute_lower_omp): Call finalize_task_copyfn here on entries from
            task_cpyfns vector and release the vector.
    
    (cherry picked from commit 6a0d6e7ca9b9e338e82572db79c26168684a7441)

Diff:
---
 gcc/omp-low.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 50a2b3b1ebd..f9aa3930803 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -177,6 +177,7 @@ static int target_nesting_level;
 static bitmap task_shared_vars;
 static bitmap global_nonaddressable_vars;
 static vec<omp_context *> taskreg_contexts;
+static vec<gomp_task *> task_cpyfns;
 
 static void scan_omp (gimple_seq *, omp_context *);
 static tree scan_omp_1_op (tree *, int *, void *);
@@ -1028,9 +1029,6 @@ delete_omp_context (splay_tree_value value)
 	DECL_ABSTRACT_ORIGIN (t) = NULL;
     }
 
-  if (is_task_ctx (ctx))
-    finalize_task_copyfn (as_a <gomp_task *> (ctx->stmt));
-
   if (ctx->task_reduction_map)
     {
       ctx->task_reductions.release ();
@@ -10901,6 +10899,7 @@ create_task_copyfn (gomp_task *task_stmt, omp_context *ctx)
   size_t looptempno = 0;
 
   child_fn = gimple_omp_task_copy_fn (task_stmt);
+  task_cpyfns.safe_push (task_stmt);
   child_cfun = DECL_STRUCT_FUNCTION (child_fn);
   gcc_assert (child_cfun->cfg == NULL);
   DECL_SAVED_TREE (child_fn) = alloc_stmt_list ();
@@ -13201,6 +13200,12 @@ execute_lower_omp (void)
       && (TREE_CODE (TREE_TYPE (DECL_ARGUMENTS (current_function_decl)))
 	  == POINTER_TYPE))
     remove_member_access_dummy_vars (DECL_INITIAL (current_function_decl));
+
+  gomp_task *task_stmt;
+  unsigned j;
+  FOR_EACH_VEC_ELT (task_cpyfns, j, task_stmt)
+    finalize_task_copyfn (task_stmt);
+  task_cpyfns.release ();
   return 0;
 }


                 reply	other threads:[~2022-05-10  8:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220510082402.49103383602B@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).