Jakub Jelinek - [gomp] Fix C++ invisiref PARM_DECLs in firstprivate/lastprivate/private (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Hi!

As shown on the attached testcase, we ICEd or segfaulted on C++ PARM_DECLs with TREE_ADDRESSABLE set, they need similar treatment to TREE_ADDRESSABLE RESULT_DECLs which are also passed by invisible reference.

While I could extend the gimplify_scan_omp_clauses test to also cover PARM_DECLs, I believe it is better to not change the OMP_CLAUSE_DECLs during C++ genericization, then we don't need to fix it up again.

Tested on x86_64-linux.

Ok for 4.3/4.2?

2007-02-06 Jakub Jelinek jakub@redhat.com

PR c++/30703
* gimplify.c (gimplify_scan_omp_clauses): Remove special casing
of INDIRECT_REF <RESULT_DECL>.

* cp-gimplify.c (cp_genericize_r): Don't dereference invisiref
parameters and result decls in omp clauses.
(cxx_omp_privatize_by_reference): Pass also invisiref PARM_DECLs
by reference.

* testsuite/libgomp.c++/pr30703.C: New test.

--- gcc/gimplify.c.jj 2007-02-01 11:03:13.000000000 +0100 +++ gcc/gimplify.c 2007-02-06 13:24:10.000000000 +0100 @@ -4747,11 +4747,6 @@ gimplify_scan_omp_clauses (tree list_p, remove = true; break; } - / Handle NRV results passed by reference. */ - if (TREE_CODE (decl) == INDIRECT_REF - && TREE_CODE (TREE_OPERAND (decl, 0)) == RESULT_DECL - && DECL_BY_REFERENCE (TREE_OPERAND (decl, 0))) - OMP_CLAUSE_DECL (c) = decl = TREE_OPERAND (decl, 0); omp_add_variable (ctx, decl, flags); if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)) @@ -4779,11 +4774,6 @@ gimplify_scan_omp_clauses (tree list_p, remove = true; break; } - / Handle NRV results passed by reference. */ - if (TREE_CODE (decl) == INDIRECT_REF - && TREE_CODE (TREE_OPERAND (decl, 0)) == RESULT_DECL - && DECL_BY_REFERENCE (TREE_OPERAND (decl, 0))) - OMP_CLAUSE_DECL (c) = decl = TREE_OPERAND (decl, 0); do_notice: if (outer_ctx) omp_notice_variable (outer_ctx, decl, true); --- gcc/cp/cp-gimplify.c.jj 2006-12-08 15:57:53.000000000 +0100 +++ gcc/cp/cp-gimplify.c 2007-02-06 14:26:12.000000000 +0100 @@ -672,6 +672,25 @@ cp_genericize_r (tree *stmt_p, int walk && is_invisiref_parm (TREE_OPERAND (stmt, 0))) / Don't dereference an invisiref RESULT_DECL inside a RETURN_EXPR. */ *walk_subtrees = 0;

@@ -911,5 +930,5 @@ cxx_omp_clause_dtor (tree clause, tree d bool cxx_omp_privatize_by_reference (tree decl) {

+} + +void +bar () +{

+}

Jakub

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]