1 /* { dg-do run } */ 2 /* { dg-require-effective-target tls_runtime } */ 3 4 #include <omp.h> 5 #include <stdlib.h> 6 7 int t = 128; 8 #pragma omp threadprivate (t) 9 10 int main()11main () 12 { 13 #pragma omp parallel 14 t = omp_get_thread_num () + 256; 15 #pragma omp parallel 16 if (t != omp_get_thread_num () + 256) 17 abort (); 18 omp_pause_resource (omp_pause_soft, omp_get_initial_device ()); 19 /* This goes beyond what is required by the standard, we actually 20 check if the threads other than the initial one have been destroyed. */ 21 #pragma omp parallel 22 { 23 if (omp_get_thread_num () != 0 && t != 128) 24 abort (); 25 t = omp_get_thread_num () + 384; 26 } 27 #pragma omp parallel 28 if (t != omp_get_thread_num () + 384) 29 abort (); 30 omp_pause_resource_all (omp_pause_hard); 31 #pragma omp parallel 32 { 33 if (omp_get_thread_num () != 0 && t != 128) 34 abort (); 35 t = omp_get_thread_num () + 512; 36 } 37 #pragma omp parallel 38 if (t != omp_get_thread_num () + 512) 39 abort (); 40 return 0; 41 } 42