udr-3.c 443 B

123456789101112131415161718192021222324252627282930313233
  1. /* { dg-do run } */
  2. extern void abort ();
  3. struct S;
  4. void foo (struct S *, struct S *);
  5. #pragma omp declare reduction (+:struct S:foo (&omp_out, &omp_in))
  6. struct S { int s; };
  7. void
  8. foo (struct S *x, struct S *y)
  9. {
  10. x->s += y->s;
  11. }
  12. int
  13. main ()
  14. {
  15. struct S s;
  16. int i = 0;
  17. s.s = 0;
  18. #pragma omp parallel reduction (+:s, i)
  19. {
  20. if (s.s != 0)
  21. abort ();
  22. s.s = 2;
  23. i = 1;
  24. }
  25. if (s.s != 2 * i)
  26. abort ();
  27. return 0;
  28. }