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 - Pointer Bounds Checking?

Status
Not open for further replies.

Fozzeebear

Technical User
Oct 20, 2003
6
GB
I am having segmentation fault problems in some code I'm developing. The reported failure point is at the deallocation of an array, although I don't think that is the actual location of the error.

I'm working with the Lahey LF95 Linux compiler. Have switched on the --chk a,e,s options which should cover bounds checking on allocatable arrays.

However, the compiler documentation mentions that it doesn't cover bounds checking for assumed size arrays or pointers.

Can anyone offer advice for debugging this bounds checks? The code is quite large, so any automated method would be preferable.
 
Are you deallocating something that has not been allocated?

You could try g95 with -fbounds-check. I know it defeats the purpose of having LF95 but you can use g95, find your problem, fix it then go back to LF95.

Alternatively, since you're using linux, you could try electric fence or valgrind. valgrind is similar to Rational's purify - a bit slow but it finds the "hard to find" violations. Works very well if you aren't using threads. Output from threaded programs is a bit confusing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top