udr-3.c 443 B

1234567891011121314151617181920212223242526272829303132
  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. }