understanding segmentation faults
- From: tholen@xxxxxxxxxxxx
- Date: Thu, 13 Nov 2008 20:28:57 +0100 (CET)
Is "segmentation fault" an error message that is issued by the operating
system rather than by the compiler run-time? If so, then I guess it's
not a problem that the compiler vendors can easily solve. I find the
error message to be particularly unhelpful in diagnosing a problem.
Case in point: I have a program written in Fortran 90 that runs just
fine on a Windows machine after being compiled with CVF 6.6c, though
it's been a while since the program was built, so I don't recall if it
was necessary to use the editbin utility to increase the stack size.
The same program would sometimes work but sometimes fail on a Linux
machine after being compiled with ifort version 10.1.008; when it
failed, the error message was the mysterious "segmentation fault". I
tracked down the offending statement to be a simple WRITE statement
with a single argument in the list, namely a subarray (or is the
technical terminology an "array section"?). Whenver the array was
about 4 MB in size, the program worked as expected, but whenever the
array was about 16 MB in size, the segmentation fault occurred. After
playing around with some command line options on the compiler, I was
able to get the program to work by using the -heap-arrays option with
the argument set to 20000 kB. I'm guessing that the compiler tried to
create a temporary to hold the array section and that there wasn't
enough memory in that pool to do so, thus causing the segmentation fault.
But I could have diagnosed the problem a lot faster if the error message
had been something like "stack overflow" like it is with CVF.
So my goal here is to try and get a better understanding of what can
cause the "segmentation fault" error message, anything that might have
helped me to reduce the debugging time. Is it a rather generic error
message that can be caused by so many different things that it would be
difficult to provide a tutorial? Or would a more experienced ifort user
have been able to diagnose the problem right away?
.
- Follow-Ups:
- Re: understanding segmentation faults
- From: Arno
- Re: understanding segmentation faults
- From: paul . richard . thomas
- Re: understanding segmentation faults
- Prev by Date: Re: data statements after executable code
- Next by Date: Re: understanding segmentation faults
- Previous by thread: data statements after executable code
- Next by thread: Re: understanding segmentation faults
- Index(es):
Relevant Pages
|