| 1 |
/* { dg-do compile } */ |
| 2 |
|
| 3 |
/* This file contains tests that are expected to fail. */ |
| 4 |
|
| 5 |
|
| 6 |
/* These jumps are all OK since they are to/from the same structured block. */ |
| 7 |
|
| 8 |
void f1a (void) |
| 9 |
{ |
| 10 |
#pragma omp for collapse(2) |
| 11 |
for (int i = 0; i < 64; ++i) |
| 12 |
{ |
| 13 |
goto a; a:; |
| 14 |
for (int j = 0; j < 64; ++j) |
| 15 |
{ |
| 16 |
goto c; c:; |
| 17 |
} |
| 18 |
goto b; b:; |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
/* Jump around loop body to/from different structured blocks of intervening |
| 23 |
code. */ |
| 24 |
void f2a (void) |
| 25 |
{ |
| 26 |
#pragma omp for collapse(2) |
| 27 |
for (int i = 0; i < 64; ++i) |
| 28 |
{ |
| 29 |
goto a; a:; |
| 30 |
if (i > 16) goto b; /* { dg-error "invalid branch to/from OpenMP structured block" } */ |
| 31 |
for (int j = 0; j < 64; ++j) |
| 32 |
{ |
| 33 |
goto c; c:; |
| 34 |
} |
| 35 |
goto b; b:; |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
/* Jump into loop body from intervening code. */ |
| 40 |
void f3a (void) |
| 41 |
{ |
| 42 |
#pragma omp for collapse(2) |
| 43 |
for (int i = 0; i < 64; ++i) |
| 44 |
{ |
| 45 |
goto a; a:; |
| 46 |
if (i > 16) goto c; /* { dg-error "invalid branch to/from OpenMP structured block" } */ |
| 47 |
for (int j = 0; j < 64; ++j) |
| 48 |
{ |
| 49 |
c: |
| 50 |
; |
| 51 |
} |
| 52 |
goto b; b:; |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
/* Jump out of loop body to intervening code. */ |
| 57 |
void f4a (void) |
| 58 |
{ |
| 59 |
#pragma omp for collapse(2) |
| 60 |
for (int i = 0; i < 64; ++i) |
| 61 |
{ |
| 62 |
goto a; a:; |
| 63 |
for (int j = 0; j < 64; ++j) |
| 64 |
if (i > 16) goto c; /* { dg-error "invalid branch to/from OpenMP structured block" } */ |
| 65 |
c: |
| 66 |
; |
| 67 |
goto b; b:; |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
/* The next group of tests use the GNU extension for local labels. Expected |
| 72 |
behavior is the same as the above group. */ |
| 73 |
|
| 74 |
/* These jumps are all OK since they are to/from the same structured block. */ |
| 75 |
|
| 76 |
void f1b (void) |
| 77 |
{ |
| 78 |
#pragma omp for collapse(2) |
| 79 |
for (int i = 0; i < 64; ++i) |
| 80 |
{ |
| 81 |
__label__ a, b, c; |
| 82 |
goto a; a:; |
| 83 |
for (int j = 0; j < 64; ++j) |
| 84 |
{ |
| 85 |
goto c; c:; |
| 86 |
} |
| 87 |
goto b; b:; |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
/* Jump around loop body to/from different structured blocks of intervening |
| 92 |
code. */ |
| 93 |
void f2b (void) |
| 94 |
{ |
| 95 |
#pragma omp for collapse(2) |
| 96 |
for (int i = 0; i < 64; ++i) |
| 97 |
{ |
| 98 |
__label__ a, b, c; |
| 99 |
goto a; a:; |
| 100 |
if (i > 16) goto b; /* { dg-error "invalid branch to/from OpenMP structured block" } */ |
| 101 |
for (int j = 0; j < 64; ++j) |
| 102 |
{ |
| 103 |
goto c; c:; |
| 104 |
} |
| 105 |
goto b; b:; |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
/* Jump into loop body from intervening code. */ |
| 110 |
void f3b (void) |
| 111 |
{ |
| 112 |
#pragma omp for collapse(2) |
| 113 |
for (int i = 0; i < 64; ++i) |
| 114 |
{ |
| 115 |
__label__ a, b, c; |
| 116 |
goto a; a:; |
| 117 |
if (i > 16) goto c; /* { dg-error "invalid branch to/from OpenMP structured block" } */ |
| 118 |
for (int j = 0; j < 64; ++j) |
| 119 |
{ |
| 120 |
c: |
| 121 |
; |
| 122 |
} |
| 123 |
goto b; b:; |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
/* Jump out of loop body to intervening code. */ |
| 128 |
void f4b (void) |
| 129 |
{ |
| 130 |
#pragma omp for collapse(2) |
| 131 |
for (int i = 0; i < 64; ++i) |
| 132 |
{ |
| 133 |
__label__ a, b, c; |
| 134 |
goto a; a:; |
| 135 |
for (int j = 0; j < 64; ++j) |
| 136 |
if (i > 16) goto c; /* { dg-error "invalid branch to/from OpenMP structured block" } */ |
| 137 |
c: |
| 138 |
; |
| 139 |
goto b; b:; |
| 140 |
} |
| 141 |
} |
| 142 |
|
| 143 |
/* Test that the even the valid jumps are rejected when intervening code |
| 144 |
is not allowed at all. */ |
| 145 |
|
| 146 |
void f1c (void) |
| 147 |
{ |
| 148 |
#pragma omp for ordered(2) |
| 149 |
for (int i = 0; i < 64; ++i) /* { dg-error "inner loops must be perfectly nested" } */ |
| 150 |
{ |
| 151 |
goto a; a:; |
| 152 |
for (int j = 0; j < 64; ++j) |
| 153 |
{ |
| 154 |
goto c; c:; |
| 155 |
} |
| 156 |
goto b; b:; |
| 157 |
} |
| 158 |
} |
| 159 |
|
| 160 |
void f1d (void) |
| 161 |
{ |
| 162 |
#pragma omp for ordered(2) |
| 163 |
for (int i = 0; i < 64; ++i) /* { dg-error "inner loops must be perfectly nested" } */ |
| 164 |
{ |
| 165 |
__label__ a, b, c; |
| 166 |
goto a; a:; |
| 167 |
for (int j = 0; j < 64; ++j) |
| 168 |
{ |
| 169 |
goto c; c:; |
| 170 |
} |
| 171 |
goto b; b:; |
| 172 |
} |
| 173 |
} |
| 174 |
|