copyin-1.c 510 B

123456789101112131415161718192021222324252627282930313233
  1. /* { dg-do run } */
  2. /* { dg-require-effective-target tls_runtime } */
  3. #include <omp.h>
  4. #include <stdlib.h>
  5. int thr = 32;
  6. #pragma omp threadprivate (thr)
  7. int
  8. main (void)
  9. {
  10. int l = 0;
  11. omp_set_dynamic (0);
  12. omp_set_num_threads (6);
  13. #pragma omp parallel copyin (thr) reduction (||:l)
  14. {
  15. l = thr != 32;
  16. thr = omp_get_thread_num () + 11;
  17. }
  18. if (l || thr != 11)
  19. abort ();
  20. #pragma omp parallel reduction (||:l)
  21. l = thr != omp_get_thread_num () + 11;
  22. if (l)
  23. abort ();
  24. return 0;
  25. }