Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

segmentation fault

Status
Not open for further replies.

Pfor

Technical User
Aug 11, 2010
22
IT
Dear All,
I am working on a F90 code I didn't write.
I would like to execute the code itself two times
(with different parameters) and I wrote a "do" loop at the beginning of the code.
Before the loop ends all the allocated arrays should be deallocated.

Unfortunately at the beginning of the second iteration a
segmentation fault (core dumped) occurs.

I think that the problem is in the allocation or deallocation of some vector.

Is there any option which allows to check which arrays have been allocated and how much memory do they require?

Do you have any suggestion how to find the error?

Thank you
sincerely
Paolo
 
Is there any option which allows to check which arrays have been allocated
try something like this:
Code:
  integer :: n    
  real, allocatable, dimension(:) :: array

  ... 

  if (allocated(array)) then
    n = size(array)
    ...
    deallocate(array)
    ...
  end if
 
If you're on Linux, you could use valgrind to find out where the segmentation violations are occuring. This is similar to Rational (IBM)'s purify.
 
Which compiler are you using? If you are using gfortran, you could add the compile option -fbounds-checking
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top