reduction-6.c 446 B

123456789101112131415161718192021222324252627282930
  1. /* { dg-do run } */
  2. extern void abort (void);
  3. int j;
  4. float f;
  5. int
  6. main ()
  7. {
  8. j = -10000;
  9. f = 1024.0;
  10. int i;
  11. #pragma omp parallel for reduction (min:f) reduction (max:j)
  12. for (i = 0; i < 4; i++)
  13. switch (i)
  14. {
  15. case 0:
  16. if (j < -16) j = -16; break;
  17. case 1:
  18. if (f > -2.0) f = -2.0; break;
  19. case 2:
  20. if (j < 8) j = 8; if (f > 9.0) f = 9.0; break;
  21. case 3:
  22. break;
  23. }
  24. if (j != 8 || f != -2.0)
  25. abort ();
  26. return 0;
  27. }