Commit 88957d5e by Paolo Carlini Committed by Paolo Carlini

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
parent d95521b4
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> 2014-12-12 Jason Merrill <jason@redhat.com>
N3922 N3922
......
...@@ -5138,6 +5138,8 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor) ...@@ -5138,6 +5138,8 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor)
id = OVL_CURRENT (id); id = OVL_CURRENT (id);
mark_used (id); mark_used (id);
tree body = DECL_SAVED_TREE (id); tree body = DECL_SAVED_TREE (id);
if (!body)
return true;
if (TREE_CODE (body) == STATEMENT_LIST) if (TREE_CODE (body) == STATEMENT_LIST)
{ {
tree_stmt_iterator tsi; tree_stmt_iterator tsi;
......
2014-12-12 Paolo Carlini <paolo.carlini@oracle.com> 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 PR c++/61924
* g++.dg/cpp0x/pr61924.C: New. * g++.dg/cpp0x/pr61924.C: New.
......
// 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)
;
}
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