Commit 4ca56230 by Paolo Carlini Committed by Paolo Carlini

re PR c++/58702 (ICE with undeclared variable in OpenMP reduction clause)

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

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

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

	PR c++/58702
	* g++.dg/gomp/pr58702.C: New.

From-SVN: r207235
parent 72ca8909
2014-01-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58702
* semantics.c (finish_omp_reduction_clause): Check type for
error_mark_node.
2014-01-28 Jason Merrill <jason@redhat.com> 2014-01-28 Jason Merrill <jason@redhat.com>
PR c++/59791 PR c++/59791
......
...@@ -5021,7 +5021,9 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor) ...@@ -5021,7 +5021,9 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor)
tree type = TREE_TYPE (t); tree type = TREE_TYPE (t);
if (TREE_CODE (type) == REFERENCE_TYPE) if (TREE_CODE (type) == REFERENCE_TYPE)
type = TREE_TYPE (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)) switch (OMP_CLAUSE_REDUCTION_CODE (c))
{ {
case PLUS_EXPR: case PLUS_EXPR:
......
2014-01-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58702
* g++.dg/gomp/pr58702.C: New.
2014-01-29 Dodji Seketeli <dodji@redhat.com> 2014-01-29 Dodji Seketeli <dodji@redhat.com>
* c-c++-common/cpp/warning-zero-location-2.c: Fix error message * c-c++-common/cpp/warning-zero-location-2.c: Fix error message
......
// 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) ;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment