aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/gomp/block-3.C
blob: ff281752843c89c68936edf7768aedcc4b3a1e8b (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
62
63
// { dg-do compile }

extern int test(int);
void foo()
{
  int i;

  for (i = 0; i < 10; ++i)
    {
      #pragma omp sections
      {
	continue;		// { dg-error "invalid exit" }
      }
    }

  #pragma omp sections
    {
    #pragma omp section
      { bad1: ; }		// { dg-error "jump to label" }
    #pragma omp section
      goto bad1;		// { dg-error "from here|enters OpenMP" }
    }

  #pragma omp sections
    {
      goto bad2;		// { dg-error "from here" }
    }
  bad2:;			// { dg-error "jump|exits OpenMP" }

  goto bad3;			// { dg-error "from here" }
  #pragma omp sections
    {
      bad3: ;			// { dg-error "jump|enters OpenMP" }
    }

  #pragma omp sections
    {
      {
	goto ok1;
	ok1:;
      }

    #pragma omp section
      for (i = 0; i < 10; ++i)
	if (test(i))
	  break;
	else
	  continue;

    #pragma omp section
      switch (i)
	{
	case 0:
	  break;
	default:
	  test(i);
	}
    }
}

// { dg-message "error: invalid branch to/from an OpenMP structured block" "" { target *-*-* } 21 }
// { dg-message "error: invalid branch to/from an OpenMP structured block" "" { target *-*-* } 26 }
// { dg-message "error: invalid entry to OpenMP structured block" "" { target *-*-* } 30 }