From f13e9cd5139762a79b41c7a355e58e36352752f6 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 22 Mar 2017 19:53:47 +0100 Subject: [PATCH] re PR c++/80141 (ICE with pragma omp declare) PR c++/80141 * semantics.c (finish_omp_clause) : Call maybe_constant_value only when not processing_template_decl. * g++.dg/gomp/pr80141.C: New test. From-SVN: r246403 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/semantics.c | 4 ++-- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/gomp/pr80141.C | 8 ++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/gomp/pr80141.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3db9895d5a8..4493515ced8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2017-03-22 Jakub Jelinek + + PR c++/80141 + * semantics.c (finish_omp_clause) : Call maybe_constant_value only when not + processing_template_decl. + 2017-03-21 Paolo Carlini PR c++/77752 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index bcfdd668c3a..ad5299a06ee 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -6416,9 +6416,9 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) else { t = mark_rvalue_use (t); - t = maybe_constant_value (t); if (!processing_template_decl) { + t = maybe_constant_value (t); if (TREE_CODE (t) != INTEGER_CST || tree_int_cst_sgn (t) != 1) { @@ -6586,9 +6586,9 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) else { t = mark_rvalue_use (t); - t = maybe_constant_value (t); if (!processing_template_decl) { + t = maybe_constant_value (t); if (TREE_CODE (t) != INTEGER_CST || tree_int_cst_sgn (t) != 1) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index add3a14eca5..d8ae1ff3fa7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2017-03-22 Jakub Jelinek + PR c++/80141 + * g++.dg/gomp/pr80141.C: New test. + PR c++/80129 * g++.dg/torture/pr80129.C: New test. diff --git a/gcc/testsuite/g++.dg/gomp/pr80141.C b/gcc/testsuite/g++.dg/gomp/pr80141.C new file mode 100644 index 00000000000..53e497ab349 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr80141.C @@ -0,0 +1,8 @@ +// PR c++/80141 +// { dg-do compile } + +#pragma omp declare simd aligned (p : 2 && 2) +template void foo (int *p); + +#pragma omp declare simd simdlen (2 && 2) +template void bar (int *p); -- 2.30.2