gcc/libgomp/testsuite/libgomp.c/pr70680-2.c
Jakub Jelinek 843110834c re PR middle-end/70680 (OpenMP SIMD linear variable privatized too eagerly)
PR middle-end/70680
	* gimplify.c (gimplify_omp_for): Call omp_notice_variable for
	implicitly linear or lastprivate iterator on the outer context.

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

From-SVN: r235232
2016-04-20 03:42:24 +02:00

80 lines
1.1 KiB
C

/* PR middle-end/70680 */
int v;
void
f1 (void)
{
int i = 0, j = 0;
#pragma omp task default(shared) if(0)
{
#pragma omp simd collapse(2)
for (i = 0; i < 10; i++)
for (j = 0; j < 10; j++)
;
v = i + j;
}
if (i != 10 || j != 10)
__builtin_abort ();
}
void
f2 (void)
{
int i = 0, j = 0;
#pragma omp task default(shared) if(0)
{
#pragma omp simd collapse(2)
for (i = 0; i < 10; i++)
for (j = 0; j < 10; j++)
;
}
if (i != 10 || j != 10)
__builtin_abort ();
}
void
f3 (void)
{
int i = 0, j = 0;
#pragma omp task default(shared) if(0)
{
#pragma omp simd collapse(2) lastprivate (i, j)
for (i = 0; i < 10; i++)
for (j = 0; j < 10; j++)
;
v = i + j;
}
if (i != 10 || j != 10)
__builtin_abort ();
}
void
f4 (void)
{
int i = 0, j = 0;
#pragma omp task default(shared) if(0)
{
#pragma omp simd collapse(2) lastprivate (i, j)
for (i = 0; i < 10; i++)
for (j = 0; j < 10; j++)
;
}
if (i != 10 || j != 10)
__builtin_abort ();
}
int
main ()
{
f1 ();
if (v++ != 20)
__builtin_abort ();
f2 ();
f3 ();
if (v++ != 20)
__builtin_abort ();
f4 ();
return 0;
}