aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c-c++-common/pr93515.c
blob: 8a69088ccec184216a65057ef7370c5043cabf39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* PR libgomp/93515 */

#include <omp.h>
#include <stdlib.h>

int
main ()
{
  int i;
  int a = 42;
#pragma omp target teams distribute parallel for defaultmap(tofrom: scalar)
  for (i = 0; i < 64; ++i)
    if (omp_get_team_num () == 0)
      if (omp_get_thread_num () == 0)
	a = 142;
  if (a != 142)
    __builtin_abort ();
  a = 42;
#pragma omp target parallel for defaultmap(tofrom: scalar)
  for (i = 0; i < 64; ++i)
    if (omp_get_thread_num () == 0)
      a = 143;
  if (a != 143)
    __builtin_abort ();
  a = 42;
#pragma omp target firstprivate(a)
  {
    #pragma omp parallel for
    for (i = 0; i < 64; ++i)
      if (omp_get_thread_num () == 0)
	a = 144;
    if (a != 144)
      abort ();
  }
  return 0;
}