gcc/libgomp/testsuite/libgomp.c++/pr86539.C
Jakub Jelinek 3a10621137 re PR middle-end/86539 (OpenMP wrong-code with taskloop and references)
PR middle-end/86539
	* gimplify.c (gimplify_omp_for): Ensure taskloop firstprivatized init
	and cond temporaries don't have reference type if iterator has
	pointer type.  For init use &for_pre_body instead of pre_p if
	for_pre_body is non-empty.

	* testsuite/libgomp.c++/pr86539.C: New test.

From-SVN: r262776
2018-07-17 10:06:25 +02:00

29 lines
505 B
C

// PR middle-end/86539
int a[384];
__attribute__((noipa)) void
foo (int &b, int &c)
{
#pragma omp taskloop shared (a) collapse(3)
for (int i = 0; i < 1; i++)
for (int *p = &b; p < &c; p++)
for (int j = 0; j < 1; j++)
if (p < &a[128] || p >= &a[256])
__builtin_abort ();
else
p[0]++;
}
int
main ()
{
#pragma omp parallel
#pragma omp single
foo (a[128], a[256]);
for (int i = 0; i < 384; i++)
if (a[i] != (i >= 128 && i < 256))
__builtin_abort ();
return 0;
}