Jonathan Peyton | c76f9f0 | 2016-06-21 19:12:07 +0000 | [diff] [blame] | 1 | // RUN: %libomp-compile-and-run |
| 2 | #include <stdio.h> |
| 3 | #include <omp.h> |
| 4 | |
| 5 | /* |
| 6 | * This test would hang when level instead of active level |
| 7 | * used to push task state. |
| 8 | */ |
| 9 | |
| 10 | int main() |
| 11 | { |
| 12 | // If num_threads is changed to a value greater than 1, then the test passes |
| 13 | #pragma omp parallel num_threads(1) |
| 14 | { |
| 15 | #pragma omp parallel |
| 16 | printf("Hello World from thread %d\n", omp_get_thread_num()); |
| 17 | } |
| 18 | |
| 19 | printf("omp_num_threads: %d\n", omp_get_max_threads()); |
| 20 | |
| 21 | #pragma omp parallel |
| 22 | { |
| 23 | #pragma omp master |
| 24 | #pragma omp task default(none) |
| 25 | { |
| 26 | printf("%d is executing this task\n", omp_get_thread_num()); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | printf("pass\n"); |
| 31 | return 0; |
| 32 | } |