aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-low.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-06-20 04:18:07 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-06-20 04:18:07 +0200
commit2368a460c8d49c4d9aa1aab2b79d6727d19f5b2c (patch)
treef28feb4e7a51182a0bf7d4ca97a21a4def2af406 /gcc/omp-low.c
parentc598874b4bc7d816b81b8f839f75029122e4fe92 (diff)
downloadgcc-2368a460c8d49c4d9aa1aab2b79d6727d19f5b2c.zip
gcc-2368a460c8d49c4d9aa1aab2b79d6727d19f5b2c.tar.gz
gcc-2368a460c8d49c4d9aa1aab2b79d6727d19f5b2c.tar.bz2
re PR c++/36523 (OpenMP task construct fails to instantiate copy constructor)
PR c++/36523 * cgraphunit.c (cgraph_process_new_functions): Don't clear node->needed and node->reachable. * cgraphbuild.c (record_reference): Handle OMP_PARALLEL and OMP_TASK. * omp-low.c (delete_omp_context): Call finalize_task_copyfn. (expand_task_call): Don't call expand_task_copyfn. (expand_task_copyfn): Renamed to... (finalize_task_copyfn): ... this. * testsuite/libgomp.c++/task-7.C: New function. From-SVN: r136977
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r--gcc/omp-low.c66
1 files changed, 34 insertions, 32 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 09b7260..db5f858 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1188,6 +1188,37 @@ new_omp_context (tree stmt, omp_context *outer_ctx)
return ctx;
}
+static void maybe_catch_exception (tree *stmt_p);
+
+/* Finalize task copyfn. */
+
+static void
+finalize_task_copyfn (tree task_stmt)
+{
+ struct function *child_cfun;
+ tree child_fn, old_fn;
+
+ child_fn = OMP_TASK_COPYFN (task_stmt);
+ if (child_fn == NULL_TREE)
+ return;
+
+ child_cfun = DECL_STRUCT_FUNCTION (child_fn);
+
+ /* Inform the callgraph about the new function. */
+ DECL_STRUCT_FUNCTION (child_fn)->curr_properties
+ = cfun->curr_properties;
+
+ old_fn = current_function_decl;
+ push_cfun (child_cfun);
+ current_function_decl = child_fn;
+ gimplify_body (&DECL_SAVED_TREE (child_fn), child_fn, false);
+ maybe_catch_exception (&BIND_EXPR_BODY (DECL_SAVED_TREE (child_fn)));
+ pop_cfun ();
+ current_function_decl = old_fn;
+
+ cgraph_add_new_function (child_fn, false);
+}
+
/* Destroy a omp_context data structures. Called through the splay tree
value delete callback. */
@@ -1218,6 +1249,9 @@ delete_omp_context (splay_tree_value value)
DECL_ABSTRACT_ORIGIN (t) = NULL;
}
+ if (is_task_ctx (ctx))
+ finalize_task_copyfn (ctx->stmt);
+
XDELETE (ctx);
}
@@ -2882,35 +2916,6 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
}
-static void maybe_catch_exception (tree *stmt_p);
-
-
-/* Finalize task copyfn. */
-
-static void
-expand_task_copyfn (tree task_stmt)
-{
- struct function *child_cfun;
- tree child_fn, old_fn;
-
- child_fn = OMP_TASK_COPYFN (task_stmt);
- child_cfun = DECL_STRUCT_FUNCTION (child_fn);
-
- /* Inform the callgraph about the new function. */
- DECL_STRUCT_FUNCTION (child_fn)->curr_properties
- = cfun->curr_properties;
-
- old_fn = current_function_decl;
- push_cfun (child_cfun);
- current_function_decl = child_fn;
- gimplify_body (&DECL_SAVED_TREE (child_fn), child_fn, false);
- maybe_catch_exception (&BIND_EXPR_BODY (DECL_SAVED_TREE (child_fn)));
- pop_cfun ();
- current_function_decl = old_fn;
-
- cgraph_add_new_function (child_fn, false);
-}
-
/* Build the function call to GOMP_task to actually
generate the task operation. BB is the block where to insert the code. */
@@ -2922,9 +2927,6 @@ expand_task_call (basic_block bb, tree entry_stmt)
clauses = OMP_TASK_CLAUSES (entry_stmt);
- if (OMP_TASK_COPYFN (entry_stmt))
- expand_task_copyfn (entry_stmt);
-
c = find_omp_clause (clauses, OMP_CLAUSE_IF);
if (c)
cond = gimple_boolify (OMP_CLAUSE_IF_EXPR (c));