parloops-exit-first-loop-alt-4.c 490 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* { dg-do run } */
  2. /* { dg-additional-options "-ftree-parallelize-loops=2" } */
  3. /* Constant bound, reduction. */
  4. #include <stdlib.h>
  5. #define N 4000
  6. unsigned int *a;
  7. unsigned int
  8. f (void)
  9. {
  10. int i;
  11. unsigned int sum = 1;
  12. for (i = 0; i < N; ++i)
  13. sum += a[i];
  14. return sum;
  15. }
  16. int
  17. main (void)
  18. {
  19. unsigned int res;
  20. unsigned int array[N];
  21. int i;
  22. for (i = 0; i < N; ++i)
  23. array[i] = i % 7;
  24. a = &array[0];
  25. res = f ();
  26. if (res != 11995)
  27. abort ();
  28. return 0;
  29. }