Segmentation fault in FORTRAN OpenMP loop

Discussion created by on Jun 3, 2011

Hi: I've been experimenting building our modestly large FORTRAN program with OpenF95 When I build with OpenMP and -O3, I get a segmentation fault in a parallelized loop. The parallelized loop is relatively straight-forward, but it is nested and it references an array element of an array of user-defined types, which itself contains an array. Also, there is yet another interior implicit loop over the leading dimension of these arrays.

do i = 1, n
   do j = i, m
     !$omp parallel do
    do k = 1, o
      do l = 1, p
         A(:,l,k) = A(:,l,k)  + B(:,l,k) * C(j)%D(:,l,k)
      end do
   end do
  !$omp end parallel do
  end do
end do

I abstracted this bit of code into a separate program and compiled it, but I cannot reproduce the segmentation fault. Could you give me some suggestions on how to reduce my code to something which I can post?