33 lines · c
1// RUN: %libomp-compile-and-run2#include <stdio.h>3#include <omp.h>4 5/*6 * This test would hang when level instead of active level7 * used to push task state.8 */9 10int main()11{12 // If num_threads is changed to a value greater than 1, then the test passes13 #pragma omp parallel num_threads(1)14 {15 #pragma omp parallel16 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 parallel22 {23 #pragma omp master24 #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}33