2016-02-11 Jakub Jelinek Backported from mainline 2016-02-08 Jakub Jelinek PR c++/59627 * parser.c (cp_parser_omp_declare_reduction): Set assembler name of the DECL_OMP_DECLARE_REDUCTION_P decls. * g++.dg/gomp/pr59627.C: New test. --- gcc/cp/parser.c (revision 233224) +++ gcc/cp/parser.c (revision 233225) @@ -36080,6 +36080,7 @@ cp_parser_omp_declare_reduction (cp_pars DECL_DECLARED_INLINE_P (fndecl) = 1; DECL_IGNORED_P (fndecl) = 1; DECL_OMP_DECLARE_REDUCTION_P (fndecl) = 1; + SET_DECL_ASSEMBLER_NAME (fndecl, get_identifier ("")); DECL_ATTRIBUTES (fndecl) = tree_cons (get_identifier ("gnu_inline"), NULL_TREE, DECL_ATTRIBUTES (fndecl)); --- gcc/testsuite/g++.dg/gomp/pr59627.C (revision 0) +++ gcc/testsuite/g++.dg/gomp/pr59627.C (revision 233225) @@ -0,0 +1,14 @@ +// PR c++/59627 +// { dg-do compile { target lto } } +// { dg-options "-fopenmp -flto" } + +struct A { A () : i (0) {} int i; }; + +void +foo () +{ + A a; + #pragma omp declare reduction (+: A: omp_out.i += omp_in.i) + #pragma omp parallel reduction (+: a) + ; +}