| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-additional-options "-fdump-tree-gimple" } */ |
| 3 |
|
| 4 |
/* PR middle-end/121922 */ |
| 5 |
|
| 6 |
/* Failed to re-check the global flag due to tree sharing. */ |
| 7 |
|
| 8 |
extern int flag; |
| 9 |
int flag = 0; |
| 10 |
|
| 11 |
int |
| 12 |
test_with_flag () |
| 13 |
{ |
| 14 |
return flag; |
| 15 |
} |
| 16 |
|
| 17 |
#pragma omp declare variant (test_with_flag) match (user={condition(score(10): flag > 1)}) |
| 18 |
int |
| 19 |
test () |
| 20 |
{ |
| 21 |
return 0; |
| 22 |
} |
| 23 |
|
| 24 |
void |
| 25 |
doit () |
| 26 |
{ |
| 27 |
flag = 0; |
| 28 |
if (test () != 0) __builtin_abort (); |
| 29 |
flag = 1; |
| 30 |
if (test () != 0) __builtin_abort (); |
| 31 |
flag = 42; |
| 32 |
if (test () != 42) __builtin_abort (); |
| 33 |
} |
| 34 |
|
| 35 |
int main () |
| 36 |
{ |
| 37 |
doit (); |
| 38 |
} |
| 39 |
|
| 40 |
/* { dg-final { scan-tree-dump-times "flag\\.\[^=\]*= flag;\[\n\r\]+ *if \\(flag\\.\[^>\]*> 1\\)" 3 "gimple" } } */ |