gcc/libgomp/testsuite/libgomp.c/nestedfn-5.c
Jakub Jelinek a70ad3bb3e re PR middle-end/25261 ([gomp] Nested function calls in #pragma omp parallel blocks)
PR middle-end/25261
	PR middle-end/28790
	* tree-nested.c (struct nesting_info): Added static_chain_added.
	(convert_call_expr): Set static_chain_added when adding static
	chain.  Handle OMP_PARALLEL and OMP_SECTION.

	* gcc.dg/gomp/nestedfn-1.c: New test.

	* testsuite/libgomp.c/nestedfn-4.c: New test.
	* testsuite/libgomp.c/nestedfn-5.c: New test.
	* testsuite/libgomp.fortran/nestedfn3.f90: New test.

From-SVN: r117235
2006-09-26 20:10:58 +02:00

39 lines
467 B
C

/* { dg-do run } */
/* { dg-options "-O2" } */
extern void abort (void);
void
foo (int *j)
{
int i = 5;
int bar (void) { return i + 1; }
#pragma omp sections
{
#pragma omp section
{
if (bar () != 6)
#pragma omp atomic
++*j;
}
#pragma omp section
{
if (bar () != 6)
#pragma omp atomic
++*j;
}
}
}
int
main (void)
{
int j = 0;
#pragma omp parallel num_threads (2)
foo (&j);
if (j)
abort ();
return 0;
}