aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2019-11-29 10:10:44 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-11-29 10:10:44 +0100
commit52702016ad1b45888ddd37e95e3eb093181fd4d3 (patch)
tree568163140fea7442c6e8bd868b88174618d79123
parentb3f44388f3bb9b42553ea516984db4c4d4baa5bc (diff)
downloadgcc-52702016ad1b45888ddd37e95e3eb093181fd4d3.zip
gcc-52702016ad1b45888ddd37e95e3eb093181fd4d3.tar.gz
gcc-52702016ad1b45888ddd37e95e3eb093181fd4d3.tar.bz2
re PR c++/60228 (ICE using lambda in #pragma omp declare reduction)
PR c++/60228 * parser.c (cp_parser_omp_declare_reduction_exprs): If processing_template_decl, wrap the combiner or initializer into EXPR_STMT. * decl.c (start_preparsed_function): Don't start a lambda scope for DECL_OMP_DECLARE_REDUCTION_P functions. (finish_function): Don't finish a lambda scope for DECL_OMP_DECLARE_REDUCTION_P functions, nor cp_fold_function them nor cp_genericize them. * mangle.c (decl_mangling_context): Look through DECL_OMP_DECLARE_REDUCTION_P functions. * semantics.c (expand_or_defer_fn_1): For DECL_OMP_DECLARE_REDUCTION_P functions, use tentative linkage, don't keep their bodies with -fkeep-inline-functions and return false at the end. * g++.dg/gomp/openmp-simd-2.C: Don't expect bodies for DECL_OMP_DECLARE_REDUCTION_P functions. * testsuite/libgomp.c++/udr-20.C: New test. * testsuite/libgomp.c++/udr-21.C: New test. From-SVN: r278832
-rw-r--r--libgomp/testsuite/libgomp.c++/udr-20.C54
-rw-r--r--libgomp/testsuite/libgomp.c++/udr-21.C54
2 files changed, 0 insertions, 108 deletions
diff --git a/libgomp/testsuite/libgomp.c++/udr-20.C b/libgomp/testsuite/libgomp.c++/udr-20.C
index 48d4fea..8338875 100644
--- a/libgomp/testsuite/libgomp.c++/udr-20.C
+++ b/libgomp/testsuite/libgomp.c++/udr-20.C
@@ -52,57 +52,3 @@ main ()
A::foo ();
B<long>::foo ();
}
-// PR c++/60228
-// { dg-additional-options "-std=c++11" }
-
-extern "C" void abort ();
-
-struct A
-{
- typedef int T;
- #pragma omp declare reduction (x : T : omp_out += omp_in + [](){ return 0; }()) initializer (omp_priv = [](){ return 0; }())
- static void foo ();
-};
-
-template <typename T>
-struct B
-{
- #pragma omp declare reduction (x : T : omp_out += omp_in + [](){ return T (0); }()) initializer (omp_priv = [](){ return T (0); }())
- static void foo ();
-};
-
-void
-A::foo ()
-{
- int r = 0, s = 0;
- #pragma omp parallel for reduction (x : r, s)
- for (int i = 0; i < 64; i++)
- {
- r++;
- s += i;
- }
- if (r != 64 || s != (64 * 63) / 2)
- abort ();
-}
-
-template <typename T>
-void
-B<T>::foo ()
-{
- T r = 0, s = 0;
- #pragma omp parallel for reduction (x : r, s)
- for (int i = 0; i < 64; i++)
- {
- r++;
- s += i;
- }
- if (r != 64 || s != (64 * 63) / 2)
- abort ();
-}
-
-int
-main ()
-{
- A::foo ();
- B<long>::foo ();
-}
diff --git a/libgomp/testsuite/libgomp.c++/udr-21.C b/libgomp/testsuite/libgomp.c++/udr-21.C
index 1ecaf47..9ec6557 100644
--- a/libgomp/testsuite/libgomp.c++/udr-21.C
+++ b/libgomp/testsuite/libgomp.c++/udr-21.C
@@ -52,57 +52,3 @@ main ()
A::foo ();
B<short>::foo ();
}
-// PR c++/60228
-// { dg-additional-options "-std=c++11" }
-
-extern "C" void abort ();
-
-struct A
-{
- typedef int T;
- #pragma omp declare reduction (y : T : [&omp_out, &omp_in]() { omp_out += omp_in; return 0; }()) initializer (omp_priv = [omp_orig]() { return omp_orig; }())
- static void foo ();
-};
-
-template <typename T>
-struct B
-{
- #pragma omp declare reduction (y : T : [&omp_out, &omp_in]() { omp_out += omp_in; return 0; }()) initializer (omp_priv = [omp_orig]() { return omp_orig; }())
- static void foo ();
-};
-
-void
-A::foo ()
-{
- int r = 0, s = 0;
- #pragma omp parallel for reduction (y : r, s)
- for (int i = 0; i < 64; i++)
- {
- r++;
- s += i;
- }
- if (r != 64 || s != (64 * 63) / 2)
- abort ();
-}
-
-template <typename T>
-void
-B<T>::foo ()
-{
- T r = 0, s = 0;
- #pragma omp parallel for reduction (y : r, s)
- for (int i = 0; i < 64; i++)
- {
- r++;
- s += i;
- }
- if (r != 64 || s != (64 * 63) / 2)
- abort ();
-}
-
-int
-main ()
-{
- A::foo ();
- B<short>::foo ();
-}