|
Assignment
In this assignment, use TotalView to locate
an error in the following program. The program is crashing with a
segmentation fault.
Details
cut and paste the code into the file seg.f
ifort -g -o seg seg.f
./seg
A segmentation fault results when a program
tries to access a memory segment that has not been allocated to the program.
Tips
- Run TotalView, select "New Program", and load seg.
- Click the "Go" button. The program will stop and point to the line where the segmentation violation occured.
- Look at the variables and determine why the seg. fault occurs.
A solution
The index chosen (100000) is outside the boundries of the array. In fact, it is so far outside, the print statement is trying to print from a piece of memory outside the program. This causes a segmentation fault when the attempt is made to access the memory.
|