allocatable memory and array in subroutine are not private - segfault issue

I am having a problem with prallelizing some code. It seems to be according to
spec but still causes errors.
I have a function called from within a parallel do loop which among other
things has several small arrays and some allocated and deallocated memory. The
spec seems to say that all that memory is private but it seems that different
instances of that function (different threads) stomp each others memory.
I haven't managed to make a minimal example since this depends on timing issues
apparantly but here are the relevant parts of the code (after cutting out what
I believe to be unrelated). This is run under linux and shows a problem with
both the intel compiler and gfortran and is run under intel core 2 duo in 64
bit mode.
There is one omp do loop directive near the start, the problematic function is EigenVecs.
The two points of problem when using more then one thread
1. the call to dsaupd (arpack eigenvalue calculation) tell me that the input values are
wrong (don't know which one because the error comes from farther). Not on the first
run of the loop, but a bit later
2. I get a segmentation fault with the two deallocate directives one line up from the end.
Removing them solves the segfault so there is some double deallocation going on
seems to me that the arrays/allocatable objects are forced to shared for some reason
the code:
-----------
integer function PeronaMalikIteration(in, out, pprms, eprms)
real*8, allocatable :: v(:, :), d(:)

Re: allocatable memory and array in subroutine are not private - segfault issue

I responded to this on the forum. Also note that the forum will replace
this mailing list shortly. In any case, you might check my comments
there. Also, you are clearly missing a lot of code here (the fragment
you sent won't compile) and it isn't at all clear what you expect the
nested do loops to compute.
-- Larry
>-----Original Message-----
>From: omp-bounces@...
[mailto:omp-bounces@...]
>On Behalf Of Micha Feigin
>Sent: Saturday, November 17, 2007 1:39 AM
>To: omp@...
>Subject: [Omp] allocatable memory and array in subroutine are
>not private - segfault issue
>
>I am having a problem with prallelizing some code. It seems to
>be according to
>spec but still causes errors.
>
>I have a function called from within a parallel do loop which
>among other
>things has several small arrays and some allocated and
>deallocated memory. The
>spec seems to say that all that memory is private but it seems
>that different
>instances of that function (different threads) stomp each
>others memory.
>