gcc/libgomp/testsuite/libgomp.c/pr49898-1.c
Jakub Jelinek 2514265077 re PR middle-end/49897 (nesting lastprivate gives incorrect result)
PR middle-end/49897
	PR middle-end/49898
	* omp-low.c (use_pointer_for_field): If disallowing copy-in/out
	in nested parallel and outer is a gimple_reg, mark it as addressable
	and set its bit in task_shared_vars bitmap too.

	* testsuite/libgomp.c/pr49897-1.c: New test.
	* testsuite/libgomp.c/pr49897-2.c: New test.
	* testsuite/libgomp.c/pr49898-1.c: New test.
	* testsuite/libgomp.c/pr49898-2.c: New test.

From-SVN: r176945
2011-07-29 19:45:42 +02:00

27 lines
374 B
C

/* PR middle-end/49898 */
/* { dg-do run } */
extern void abort (void);
int
main ()
{
int i, j, sum = 0;
#pragma omp parallel
{
#pragma omp for reduction(+:sum)
for (i = 0; i < 10; i++)
{
#pragma omp parallel
{
#pragma omp for reduction(+:sum)
for (j = 0; j < 10; j++)
sum += j;
}
}
}
if (sum != 450)
abort ();
return 0;
}