summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp/teams-1.c
blob: a5370470cde6b754cd83077e9d6faf16d4cc3ea6 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* { dg-do compile } */

void
foo (int x)
{
  bad1:
  #pragma omp target teams
    goto bad1; // { dg-error "invalid branch to/from OpenMP structured block" }

  goto bad2; // { dg-error "invalid entry to OpenMP structured block" }
  #pragma omp target teams
    {
      bad2: ;
    }

  #pragma omp target teams
    {
      int i;
      goto ok1;
      for (i = 0; i < 10; ++i)
	{ ok1: break; }
    }

  switch (x) // { dg-error "invalid entry to OpenMP structured block" }
  {
  #pragma omp target teams
    { case 0:; } // { dg-warning "statement will never be executed" }
  }
}

void
bar (int x)
{
  bad1:
  #pragma omp target
  #pragma omp teams
    goto bad1; // { dg-error "invalid branch to/from OpenMP structured block" }

  goto bad2; // { dg-error "invalid entry to OpenMP structured block" }
  #pragma omp target
  #pragma omp teams
    {
      bad2: ;
    }

  #pragma omp target
  #pragma omp teams
    {
      int i;
      goto ok1;
      for (i = 0; i < 10; ++i)
	{ ok1: break; }
    }

  switch (x) // { dg-error "invalid entry to OpenMP structured block" }
  {
  #pragma omp target // { dg-warning "statement will never be executed" }
  #pragma omp teams
    { case 0:; }
  }
}