gcc/libgomp/testsuite/libgomp.c/pr80394.c
Jakub Jelinek fbc698e0f4 re PR libgomp/80394 (Empty OpenMP task is wrongly removed when optimizing)
PR libgomp/80394
	* omp-low.c (scan_omp_task): Don't optimize away empty tasks
	if they have any depend clauses.

	* testsuite/libgomp.c/pr80394.c: New test.

From-SVN: r246849
2017-04-11 19:15:47 +02:00

23 lines
365 B
C

/* PR libgomp/80394 */
int
main ()
{
int x = 0;
#pragma omp parallel shared(x)
#pragma omp single
{
#pragma omp task depend(inout: x)
{
for (int i = 0; i < 100000; i++)
asm volatile ("" : : : "memory");
x += 5;
}
#pragma omp task if (0) depend(inout: x)
;
if (x != 5)
__builtin_abort ();
}
return 0;
}