re PR c++/59628 (ICE with invalid OpenMP "declare reduction" clause)

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

	PR c++/59628
	* semantics.c (finish_omp_reduction_clause): Early return true
	if DECL_SAVED_TREE (id) is NULL_TREE.

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

	PR c++/59628
	* g++.dg/gomp/pr59628.C: New.

From-SVN: r218692
This commit is contained in:
Paolo Carlini 2014-12-12 21:50:12 +00:00 committed by Paolo Carlini
parent d95521b411
commit 88957d5e14
4 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2014-12-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/59628
* semantics.c (finish_omp_reduction_clause): Early return true
if DECL_SAVED_TREE (id) is NULL_TREE.
2014-12-12 Jason Merrill <jason@redhat.com>
N3922

View File

@ -5138,6 +5138,8 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor)
id = OVL_CURRENT (id);
mark_used (id);
tree body = DECL_SAVED_TREE (id);
if (!body)
return true;
if (TREE_CODE (body) == STATEMENT_LIST)
{
tree_stmt_iterator tsi;

View File

@ -1,3 +1,8 @@
2014-12-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/59628
* g++.dg/gomp/pr59628.C: New.
2014-12-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/61924

View File

@ -0,0 +1,13 @@
// PR c++/59628
// { dg-do compile }
// { dg-options "-fopenmp" }
struct A { int i; };
void foo()
{
A a;
#pragma omp declare reduction (+: A: omp_out.i +: omp_in.i) // { dg-error "expected" }
#pragma omp parallel reduction (+: a)
;
}