On Wed, 10 Mar 1999 [log in to unmask] wrote:
>
> Jaehoon Seol wrote:
> > Can you please tell me under what circumstances DEALLOCATE can cause
> > segmentation fault error? I was developing a program which simulate set
> > operation. Since the size of set will be relatively small, I have decided
> > to use pointer with allocate instead of linked list. But, in the following
> > code, the statement 2 is causing segmentation fault error which I couldn't
> > understand why. If 2 is causing segmentation fault error, why not the
> > statement 1?
> >
> > integer,dimension(:),pointer :: oldset, newset
> >
> > allocate(oldset(1))
> > oldset(1) = 1
> > do,... <===== Go through lists of elem.
> >
> > if we have to add elem to the newset,
> > call putElement(newset,oldset,elem)
> > print *, oldset <====== 1
> > deallocate(oldset,stat=error) <====== 2
> > if ( error /= 0 ) then
> > print *,"Dealloc Error"
> > stop
> > end if
> > oldset=>newset
> > nullify(newset)
> > end do
> >
> > The newset is allocated inside putElement() routine.
> >
> >
>
> It seems that there is a bug in some compilers when
> deallocation of several objects is not in reverse
> order from their allocation. Could it be affecting you ?
After fixing the problem, I think it is possible since the modified one
shouldn't make any difference in my understanding of FORTRAN 90. But I
like to be more careful and think about that.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|