pr32362-3.c 632 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* PR middle-end/32362 */
  2. /* { dg-do run } */
  3. /* { dg-options "-O2" } */
  4. #include <omp.h>
  5. #include <stdlib.h>
  6. int a = 2;
  7. int
  8. main ()
  9. {
  10. int n[4] = { -1, -1, -1, -1 };
  11. int b = 4;
  12. omp_set_num_threads (4);
  13. omp_set_dynamic (0);
  14. omp_set_nested (1);
  15. #pragma omp parallel private(b)
  16. {
  17. b = omp_get_thread_num ();
  18. #pragma omp parallel firstprivate(a)
  19. {
  20. a = (omp_get_thread_num () + a) + 1;
  21. if (b == omp_get_thread_num ())
  22. n[omp_get_thread_num ()] = a + (b << 4);
  23. }
  24. }
  25. if (n[0] != 3)
  26. abort ();
  27. if (n[3] != -1
  28. && (n[1] != 0x14 || n[2] != 0x25 || n[3] != 0x36))
  29. abort ();
  30. return 0;
  31. }