Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

debugging segmentation faul

abaraldi
Beginner
312 Views
Hi everyone,
I am dealing witha subtle bug in a code I am developing with Intel fortran on Linux. I am receiving a segmentation fault on a write(*,*) statement. This statement is the first line of a subroutine. I know that the memory issue is probably not there. In fact when I remove that write statement or do not call that subroutine everything seems fine. The problem could be anywhere in the code, but how to pin it down? I tried with the -CB option on all the executables when compiling but nothing is noticed by ifort. Also, I cannot gather extra information from the debugger idb. Any hints much appreciated!
Cheers
AB
0 Kudos
3 Replies
Tim_Gallagher
New Contributor II
312 Views
Are you sure that the subroutine is called correctly (correct number/shape of arguments)? If it's not in a module, try compiling with

-gen-interfaces -warn interfaces

to make sure the routine is called as expected.

Generally seg. faults at really strange lines inside of subroutines indicate it's not being called correctly by passing arrays that are the wrong size/shape or the wrong number of arguments.

Tim
0 Kudos
TimP
Honored Contributor III
312 Views
It's possible to overflow stack upon entry to a subroutine, particularly if arrays are going on stack (recursive/auto/parallel compatible mode). I don't see how you can "know" that it's probably not a memory issue, without investigating. Did you check the specific writeup on the subject at the top of the forum?
0 Kudos
abaraldi
Beginner
312 Views
Hi tim18, if you read my post I didn't say that. I just said that maybe the meory problem is not in the subroutine but somewhere else.
I did compile with -gen interface -warn interface, always do...
0 Kudos
Reply