Retro68/gcc/libgomp/testsuite/libgomp.c++/default-1.C
2022-10-27 20:55:19 +02:00

30 lines
585 B
C

#include <omp.h>
#include <stdlib.h>
struct S { S () : s (42) {} S (const S &x) : s (x.s) {}; ~S () {} int s; };
int
main ()
{
S s;
s.s = 113;
#pragma omp parallel num_threads(4) default(firstprivate)
{
if (s.s != 113)
abort ();
s.s = omp_get_thread_num ();
#pragma omp barrier
if (s.s != omp_get_thread_num ())
abort ();
}
#pragma omp parallel num_threads(4) default(private)
{
if (s.s != 42)
abort ();
s.s = omp_get_thread_num () + 13;
#pragma omp barrier
if (s.s != omp_get_thread_num () + 13)
abort ();
}
}