gcc/libgomp/testsuite/libgomp.c/pr80809-1.c
Jakub Jelinek e9e2ef9f2f re PR middle-end/80809 (Multi-free error for variable size array used within OpenMP task)
PR middle-end/80809
	* gimplify.c (omp_add_variable): For GOVD_DEBUG_PRIVATE use
	GOVD_SHARED rather than GOVD_PRIVATE with it.
	(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Expect
	GOVD_SHARED rather than GOVD_PRIVATE with GOVD_DEBUG_PRIVATE.

	* testsuite/libgomp.c/pr80809-1.c: New test.

From-SVN: r248345
2017-05-22 20:54:05 +02:00

30 lines
521 B
C

/* PR middle-end/80809 */
/* { dg-do run } */
__attribute__((noinline, noclone)) void
foo (int x)
{
int i, j, v[x], *w[16];
for (i = 0; i < x; i++)
v[i] = i;
#pragma omp parallel
#pragma omp single
for (i = 0; i < 16; i++)
/* Make sure v is implicitly determined shared in task, because it
is shared on the parallel. */
#pragma omp task private (j)
w[i] = v;
for (i = 0; i < 16; i++)
if (w[i] != v)
__builtin_abort ();
}
int
main ()
{
foo (4);
foo (27);
foo (196);
return 0;
}