This is the mail archive of the gcc-patches@gcc.gnu.org mailing 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]

[committed] Fix C++ ICE with UDRs (PR c++/58874)


Hi!

The problem on this testcase was that
start_preparsed_function called maybe_begin_member_template_processing
but finish_function wasn't called with matching flag and thus
didn't call maybe_end_member_template_processing and we ended up with
processing_template_decl even when it shouldn't be set.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk.

2013-11-26  Jakub Jelinek  <jakub@redhat.com>

	PR c++/58874
	* parser.c (cp_parser_late_parsing_for_member): For OpenMP UDRs
	pass 2 instead of 0 to finish_function.

	* g++.dg/gomp/pr58874.C: New test.

--- gcc/cp/parser.c.jj	2013-11-25 10:20:12.000000000 +0100
+++ gcc/cp/parser.c	2013-11-26 17:13:16.104183792 +0100
@@ -23275,7 +23275,7 @@ cp_parser_late_parsing_for_member (cp_pa
 	{
 	  parser->lexer->in_pragma = true;
 	  cp_parser_omp_declare_reduction_exprs (member_function, parser);
-	  finish_function (0);
+	  finish_function (/*inline*/2);
 	  cp_check_omp_declare_reduction (member_function);
 	}
       else
--- gcc/testsuite/g++.dg/gomp/pr58874.C.jj	2013-11-26 17:15:35.534470121 +0100
+++ gcc/testsuite/g++.dg/gomp/pr58874.C	2013-11-26 17:18:44.487502021 +0100
@@ -0,0 +1,14 @@
+// PR c++/58874
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+struct A
+{
+  template<int> struct B
+  {
+    #pragma omp declare reduction (x : int : omp_out |= omp_in)
+  };
+};
+
+#pragma omp declare reduction (y : long : omp_out |= omp_in) \
+	initializer (omp_priv = 0)

	Jakub


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