gcc/libgomp/testsuite/libgomp.c/pr70680-1.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

76 lines
931 B
C

/* PR middle-end/70680 */
int v;
void
f1 (void)
{
int i = 0;
#pragma omp task default(shared) if(0)
{
#pragma omp simd
for (i = 0; i < 100; i++)
;
v = i;
}
if (i != 100)
__builtin_abort ();
}
void
f2 (void)
{
int i = 0;
#pragma omp task default(shared) if(0)
{
#pragma omp simd
for (i = 0; i < 100; i++)
;
}
if (i != 100)
__builtin_abort ();
}
void
f3 (void)
{
int i = 0;
#pragma omp task default(shared) if(0)
{
#pragma omp simd linear(i: 1)
for (i = 0; i < 100; i++)
;
v = i;
}
if (i != 100)
__builtin_abort ();
}
void
f4 (void)
{
int i = 0;
#pragma omp task default(shared) if(0)
{
#pragma omp simd linear(i: 1)
for (i = 0; i < 100; i++)
;
}
if (i != 100)
__builtin_abort ();
}
int
main ()
{
f1 ();
if (v++ != 100)
__builtin_abort ();
f2 ();
f3 ();
if (v++ != 100)
__builtin_abort ();
f4 ();
return 0;
}