From: Paolo Carlini Date: Fri, 12 Dec 2014 21:50:12 +0000 (+0000) Subject: re PR c++/59628 (ICE with invalid OpenMP "declare reduction" clause) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=88957d5e1497d3e27e31f3513866e7d88904c08f;p=gcc.git re PR c++/59628 (ICE with invalid OpenMP "declare reduction" clause) /cp 2014-12-12 Paolo Carlini 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 PR c++/59628 * g++.dg/gomp/pr59628.C: New. From-SVN: r218692 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4fb8a13c322..576610deed0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-12-12 Paolo Carlini + + 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 N3922 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 8a1de7e095c..5ad391eda5b 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 378f30973f3..767617798ab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-12-12 Paolo Carlini + + PR c++/59628 + * g++.dg/gomp/pr59628.C: New. + 2014-12-12 Paolo Carlini PR c++/61924 diff --git a/gcc/testsuite/g++.dg/gomp/pr59628.C b/gcc/testsuite/g++.dg/gomp/pr59628.C new file mode 100644 index 00000000000..518200b9c29 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr59628.C @@ -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) + ; +}