[C++ Patch] PR 58072

Paolo Carlini paolo.carlini@oracle.com
Wed Jan 29 12:30:00 GMT 2014


Hi,

a very simple ICE on invalid regression present only in mainline. Tested 
x86_64-linux.

Thanks,
Paolo.

///////////////////
-------------- next part --------------
/cp
2014-01-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58072
	* semantics.c (finish_omp_reduction_clause): Check type for
	error_mark_node.

/testsuite
2014-01-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58072
	* g++.dg/gomp/pr58702.C: New.
-------------- next part --------------
Index: cp/semantics.c
===================================================================
--- cp/semantics.c	(revision 207234)
+++ cp/semantics.c	(working copy)
@@ -5021,7 +5021,9 @@ finish_omp_reduction_clause (tree c, bool *need_de
   tree type = TREE_TYPE (t);
   if (TREE_CODE (type) == REFERENCE_TYPE)
     type = TREE_TYPE (type);
-  if (ARITHMETIC_TYPE_P (type))
+  if (type == error_mark_node)
+    return true;
+  else if (ARITHMETIC_TYPE_P (type))
     switch (OMP_CLAUSE_REDUCTION_CODE (c))
       {
       case PLUS_EXPR:
Index: testsuite/g++.dg/gomp/pr58702.C
===================================================================
--- testsuite/g++.dg/gomp/pr58702.C	(revision 0)
+++ testsuite/g++.dg/gomp/pr58702.C	(working copy)
@@ -0,0 +1,10 @@
+// PR c++/58702
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+void foo()
+{
+  x;   // { dg-error "was not declared" }
+#pragma omp parallel for reduction(+:x)
+  for (int i = 0; i < 10; ++i) ;
+}


More information about the Gcc-patches mailing list