aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/mangle.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-11-29 10:08:46 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-11-29 10:08:46 +0100
commitb3f44388f3bb9b42553ea516984db4c4d4baa5bc (patch)
treedee1724a138a934e00ff1750d1c62706cdd1971a /gcc/cp/mangle.c
parentefeeda757691b13e716c6681e7f6af5f85927e92 (diff)
downloadgcc-b3f44388f3bb9b42553ea516984db4c4d4baa5bc.zip
gcc-b3f44388f3bb9b42553ea516984db4c4d4baa5bc.tar.gz
gcc-b3f44388f3bb9b42553ea516984db4c4d4baa5bc.tar.bz2
re PR c++/60228 (ICE using lambda in #pragma omp declare reduction)
PR c++/60228 * parser.c (cp_parser_omp_declare_reduction_exprs): If processing_template_decl, wrap the combiner or initializer into EXPR_STMT. * decl.c (start_preparsed_function): Don't start a lambda scope for DECL_OMP_DECLARE_REDUCTION_P functions. (finish_function): Don't finish a lambda scope for DECL_OMP_DECLARE_REDUCTION_P functions, nor cp_fold_function them nor cp_genericize them. * mangle.c (decl_mangling_context): Look through DECL_OMP_DECLARE_REDUCTION_P functions. * semantics.c (expand_or_defer_fn_1): For DECL_OMP_DECLARE_REDUCTION_P functions, use tentative linkage, don't keep their bodies with -fkeep-inline-functions and return false at the end. * g++.dg/gomp/openmp-simd-2.C: Don't expect bodies for DECL_OMP_DECLARE_REDUCTION_P functions. * testsuite/libgomp.c++/udr-20.C: New test. * testsuite/libgomp.c++/udr-21.C: New test. From-SVN: r278831
Diffstat (limited to 'gcc/cp/mangle.c')
-rw-r--r--gcc/cp/mangle.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 0ac0451..88c5fa2 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -873,7 +873,16 @@ decl_mangling_context (tree decl)
else if (template_type_parameter_p (decl))
/* template type parms have no mangling context. */
return NULL_TREE;
- return CP_DECL_CONTEXT (decl);
+
+ tcontext = CP_DECL_CONTEXT (decl);
+
+ /* Ignore the artificial declare reduction functions. */
+ if (tcontext
+ && TREE_CODE (tcontext) == FUNCTION_DECL
+ && DECL_OMP_DECLARE_REDUCTION_P (tcontext))
+ return decl_mangling_context (tcontext);
+
+ return tcontext;
}
/* <name> ::= <unscoped-name>