gcc/libgomp/testsuite/libgomp.c/pr35196.c
Jakub Jelinek ac84c0623d re PR middle-end/35196 (lastprivate broken for static non-ordered loops)
PR middle-end/35196
	* omp-low.c (expand_omp_for_generic): Don't initialize fd->v
	in entry_bb.
	(expand_omp_for_static_nochunk): Initialize fd->v in seq_start_bb
	rather than in entry_bb.

	* testsuite/libgomp.c/pr35196.c: New test.

From-SVN: r132351
2008-02-15 18:42:25 +01:00

44 lines
1.1 KiB
C

/* PR middle-end/35196 */
/* { dg-do run } */
extern void abort (void);
extern void omp_set_dynamic (int);
int
main (void)
{
int i, j;
omp_set_dynamic (0);
#pragma omp parallel for lastprivate (i, j) num_threads (8) schedule (static)
for (i = 0; i < 5; i++)
j = i;
if (i != 5 || j != 4)
abort ();
#pragma omp parallel for lastprivate (i, j) num_threads (8) schedule (static, 2)
for (i = 0; i < 5; i++)
j = i;
if (i != 5 || j != 4)
abort ();
#pragma omp parallel for lastprivate (i, j) num_threads (8) schedule (dynamic)
for (i = 0; i < 5; i++)
j = i;
if (i != 5 || j != 4)
abort ();
#pragma omp parallel for lastprivate (i, j) num_threads (8) schedule (static)
for (i = -12; i < 21; i += 3)
j = i;
if (i != 21 || j != 18)
abort ();
#pragma omp parallel for lastprivate (i, j) num_threads (8) schedule (static, 2)
for (i = -12; i < 21; i += 3)
j = i;
if (i != 21 || j != 18)
abort ();
#pragma omp parallel for lastprivate (i, j) num_threads (8) schedule (dynamic, 3)
for (i = -12; i < 21; i += 3)
j = i;
if (i != 21 || j != 18)
abort ();
return 0;
}