1 /* { dg-require-effective-target size32plus } */
2 /* Same as scan-9.c, instead of using { ... } it simply uses multiple
3 executable stmt before 'omp scan'. */
5 extern void abort (void);
6 int r
, a
[1024], b
[1024], x
, y
, z
;
8 __attribute__((noipa
)) void
11 #pragma omp for reduction (inscan, +:r) lastprivate (conditional: z) firstprivate (x) private (y)
12 for (int i
= 0; i
< 1024; i
++)
16 #pragma omp scan inclusive(r)
18 if ((i
& 1) == 0 && i
< 937)
23 __attribute__((noipa
)) int
28 #pragma omp for reduction (inscan, +:s) firstprivate (x) private (y) lastprivate (z)
29 for (int i
= 0; i
< 1024; i
++)
31 y
= 2 * a
[i
]; s
+= y
; z
= y
;
32 #pragma omp scan inclusive(s)
33 y
= s
; b
[i
] = y
+ x
+ 12;
38 __attribute__((noipa
)) void
41 #pragma omp parallel for reduction (inscan, +:r) firstprivate (x) lastprivate (x)
42 for (int i
= 0; i
< 1024; i
++)
44 r
+= a
[i
] + x
+ 12; if (i
== 1023) x
= 29;
45 #pragma omp scan inclusive(r)
50 __attribute__((noipa
)) int
54 #pragma omp parallel for reduction (inscan, +:s) lastprivate (conditional: x, y)
55 for (int i
= 0; i
< 1024; i
++)
57 s
+= 2 * a
[i
]; if ((a
[i
] & 1) == 1 && i
< 825) x
= a
[i
];
58 #pragma omp scan inclusive(s)
59 b
[i
] = s
; if ((a
[i
] & 1) == 0 && i
< 829) y
= a
[i
];
69 for (int i
= 0; i
< 1024; ++i
)
77 if (r
!= 1024 * 1023 / 2 || x
!= -12 || z
!= b
[936])
79 for (int i
= 0; i
< 1024; ++i
)
87 if (bar () != 1024 * 1023 || x
!= -12 || z
!= 2 * 1023)
90 for (int i
= 0; i
< 1024; ++i
)
100 if (r
!= 1024 * 1023 / 2 || x
!= 29)
103 for (int i
= 0; i
< 1024; ++i
)
111 if (qux () != 1024 * 1023 || x
!= 823 || y
!= 828)
114 for (int i
= 0; i
< 1024; ++i
)