diff options
Diffstat (limited to 'gcc-4.9/libgomp/testsuite/libgomp.c++/udr-4.C')
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c++/udr-4.C | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c++/udr-4.C b/gcc-4.9/libgomp/testsuite/libgomp.c++/udr-4.C new file mode 100644 index 000000000..3e717467a --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c++/udr-4.C @@ -0,0 +1,32 @@ +// { dg-do run } + +extern "C" void abort (); + +struct S +{ + int s; + S () : s (0) {} + ~S () {} +}; + +#pragma omp declare reduction (+:S:omp_out.s += omp_in.s) +#pragma omp declare reduction (foo:S:omp_out.s += omp_in.s) +#pragma omp declare reduction (foo:int:omp_out += omp_in) + +int +main () +{ + int i, u = 0, q = 0; + S s, t; + if (s.s != 0 || t.s != 0) abort (); + #pragma omp parallel reduction(+:s, q) reduction(foo:t, u) + { + if (s.s != 0 || t.s != 0 || u != 0 || q != 0) abort (); + s.s = 6; + t.s = 8; + u = 9; + q++; + } + if (s.s != 6 * q || t.s != 8 * q || u != 9 * q) abort (); + return 0; +} |