libgomp/testsuite/libgomp.c++/loop-4.C
raw| 1 | extern "C" void abort (void); |
| 2 | |
| 3 | int |
| 4 | main() |
| 5 | { |
| 6 | int i, a; |
| 7 | |
| 8 | a = 30; |
| 9 | |
| 10 | #pragma omp parallel for firstprivate (a) lastprivate (a) \ |
| 11 | num_threads (2) schedule(static) |
| 12 | for (i = 0; i < 10; i++) |
| 13 | a = a + i; |
| 14 | |
| 15 | /* The thread that owns the last iteration will have computed |
| 16 | 30 + 5 + 6 + 7 + 8 + 9 = 65. */ |
| 17 | if (a != 65) |
| 18 | abort (); |
| 19 | |
| 20 | return 0; |
| 21 | } |