From: Jakub Jelinek Date: Fri, 30 Mar 2018 18:38:36 +0000 (+0200) Subject: re PR c++/84791 (ICE with broken OpenMP reduction clause) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9d620422f5ba32ae0dc1daf47da5382f876408f5;p=gcc.git re PR c++/84791 (ICE with broken OpenMP reduction clause) PR c++/84791 * semantics.c (finish_omp_reduction_clause): If OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true even if processing_template_decl. * g++.dg/gomp/pr84791.C: New test. From-SVN: r258981 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 77c729c979e..13b2435109a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2018-03-30 Jakub Jelinek + + PR c++/84791 + * semantics.c (finish_omp_reduction_clause): If + OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true + even if processing_template_decl. + 2018-03-29 David Malcolm PR c++/84269 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 035e3951574..eef9e2f645d 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5623,7 +5623,11 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor) return false; } else if (processing_template_decl) - return false; + { + if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c) == error_mark_node) + return true; + return false; + } tree id = OMP_CLAUSE_REDUCTION_PLACEHOLDER (c); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e17846e9c48..31d0f011d5a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-30 Jakub Jelinek + + PR c++/84791 + * g++.dg/gomp/pr84791.C: New test. + 2018-03-30 Paul Thomas PR fortran/84931 diff --git a/gcc/testsuite/g++.dg/gomp/pr84791.C b/gcc/testsuite/g++.dg/gomp/pr84791.C new file mode 100644 index 00000000000..4e6d3b8fd44 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr84791.C @@ -0,0 +1,15 @@ +// PR c++/84791 +// { dg-do compile } + +typedef int I; + +template +void +foo () +{ + I i; + #pragma omp parallel reduction (I::I: i) // { dg-error "'I' is not a class, namespace, or enumeration" "" { target c++11 } } + ; // { dg-error "'I' is not a class or namespace" "" { target c++98_only } .-1 } +} + +template void foo<0> ();