03742a9b01
PR other/39591 * omp-low.c (remove_exit_barrier): Don't optimize if there are any addressable variables in the parallel that could go out of scope while running queued tasks. * testsuite/libgomp.c/pr39591-1.c: New test. * testsuite/libgomp.c/pr39591-2.c: New test. * testsuite/libgomp.c/pr39591-3.c: New test. From-SVN: r145390
34 lines
543 B
C
34 lines
543 B
C
/* PR other/39591 */
|
|
/* { dg-do run } */
|
|
/* { dg-options "-O2" } */
|
|
|
|
extern void abort (void);
|
|
|
|
int err;
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
#pragma omp parallel
|
|
{
|
|
int array[40];
|
|
int i;
|
|
for (i = 0; i < sizeof array / sizeof array[0]; i++)
|
|
array[i] = 0x55555555;
|
|
|
|
#pragma omp for schedule(dynamic)
|
|
for (i = 0; i < 50; i++)
|
|
#pragma omp task shared(array)
|
|
{
|
|
int j;
|
|
for (j = 0; j < sizeof array / sizeof array[0]; j++)
|
|
if (array[j] != 0x55555555)
|
|
#pragma omp atomic
|
|
err++;
|
|
}
|
|
}
|
|
if (err)
|
|
abort ();
|
|
return 0;
|
|
}
|