2 // { dg-do compile { target lto } }
3 // { dg-options "-fopenmp -flto" }
5 extern "C" int omp_get_cancellation ();
6 extern "C" int omp_get_thread_num ();
7 extern "C" void abort ();
9 struct A { A (); ~A (); A (const A &); static int cnt1, cnt2, cnt3; int a; };
18 A::A (const A &x) : a (x.a)
28 #pragma omp declare reduction (+: A: omp_out.a += omp_in.a)
35 long int e[2] = { 1L, 1L };
39 if (x && omp_get_thread_num () == 0)
41 for (int i = 0; i < 10000000; ++i)
44 #pragma omp cancel parallel
46 #pragma omp for reduction (task, +: a, b) reduction (task, *: d, e)
47 for (int i = 0; i < 64; i++)
48 #pragma omp task in_reduction (+: a, b) in_reduction (*: d, e)
53 d *= ((i & 7) == 0) + 1;
54 e[0] *= ((i & 7) == 3) + 1;
55 e[1] *= ((i & 3) == 2) + 1;
57 if (x && omp_get_cancellation ())
62 if (a.a != 64 || b[0].a != 128 || b[1].a != 192)
64 if (d != 256 || e[0] != 256L || e[1] != 65536L)
72 int c1 = A::cnt1, c2 = A::cnt2, c3 = A::cnt3;
73 volatile int zero = 0;
75 if (A::cnt1 + A::cnt2 - c1 - c2 != A::cnt3 - c3)