I am testing the OpenMP support of the current gcc and use the following test
program:

long long i, num_steps = 1000000;
double x, sum=0.0;
double step=1.0/(double) num_steps;

#pragma omp parallel for private(i,x) reduction(+:sum)
for(i=0; i<num_steps; i++)
{
   x = (i+0.5)*step;
   sum += 4.0/(1.0 + x*x);
}

printf("PI = %f\n", sum*step);

Unfortunatly, I got a segmentation fault after the parallel loop. The gdb shows
me following backtrace:

#0  gomp_barrier_wait (barrier=0x2c) at mutex.h:47
#1  0x4001be9f in gomp_team_end ()
    at /home/stefan/Projekte/sciomp/gcc/libgomp/team.c:314
#2  0x080487b0 in main (argc=1, argv=0xbfffdd74) at pi.c:18

I think that the implicit barrier after the parallel loop is not initialized.
My example works very well with other OpenMP conpilers (e.g. Intel's C/C++
compiler).


-- 
           Summary: OpenMP-parallelized program crashes after a parallel for
                    loop
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stefan dot lankes at rwth-aachen dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28898

Reply via email to