pr38650.c 810 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* PR c++/38650 */
  2. /* { dg-do run } */
  3. #include <stdlib.h>
  4. int e;
  5. int
  6. main ()
  7. {
  8. volatile int i, j = 10;
  9. e = 0;
  10. #pragma omp parallel for reduction(+:e)
  11. for (i = 0; i < j; i += 1)
  12. e++;
  13. if (e != 10)
  14. abort ();
  15. e = 0;
  16. #pragma omp parallel for reduction(+:e)
  17. for (i = 0; i < j; ++i)
  18. e++;
  19. if (e != 10)
  20. abort ();
  21. e = 0;
  22. #pragma omp parallel for reduction(+:e)
  23. for (i = 0; i < j; i++)
  24. e++;
  25. if (e != 10)
  26. abort ();
  27. e = 0;
  28. #pragma omp parallel for reduction(+:e)
  29. for (i = 0; i < 10; i += 1)
  30. e++;
  31. if (e != 10)
  32. abort ();
  33. e = 0;
  34. #pragma omp parallel for reduction(+:e)
  35. for (i = 0; i < 10; ++i)
  36. e++;
  37. if (e != 10)
  38. abort ();
  39. e = 0;
  40. #pragma omp parallel for reduction(+:e)
  41. for (i = 0; i < 10; i++)
  42. e++;
  43. if (e != 10)
  44. abort ();
  45. return 0;
  46. }