As mentioned in my http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00035.html mail, nested function calls in #pragma omp parallel blocks are still broken (for all of C/C++/Fortran and at least in Fortran they are part of the standards) and I'm even not sure what the exact semantics should be for them if e.g. some of the variables the nested fns refer to are privatized in the parallel and some are not. Below is just a short testcase, we'll need several more testcases to cover this when it is actually fixed.
/* { dg-do run } */ #include <omp.h> extern void abort (void); int main (void) { int i = 5, j, l = 0; int foo (void) { return i == 6; } int bar (void) { return i - 3; } omp_set_dynamic (0); #pragma omp parallel for schedule (static, bar ()) num_threads (2) \ reduction (|:l) for (j = 0; j < 4; j++) if (omp_get_thread_num () != (j < 2)) l = 1; i++; #pragma omp parallel for schedule (static, bar ()) num_threads (2) \ reduction (|:l) for (j = 0; j < 6; j++) if (omp_get_thread_num () != (j < 3)) l = 1; #pragma omp parallel num_threads (4) reduction (|:l) if (! foo () || bar () != 3) l = 1; i++; #pragma omp parallel num_threads (4) reduction (|:l) if (foo () || bar () != 4) l = 1; if (l) abort (); return 0; } -- Summary: [gomp] Nested function calls in #pragma omp parallel blocks Product: gcc Version: 4.1.0 Status: UNCONFIRMED Keywords: openmp Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jakub at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25261