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

executable crashes / stops without error

mr_katse
Beginner
8,271 Views
hi!
i am using a fortran-program which rewrites many files (in sum about 26000 files) into 1 file.
the input-files are opened one by one and closed after reading.
in ivf i have the issue, that the executable just stops without an error after opening/reading/closing about 16000 files. at the moment my workaround is to compile my code in compaq visual fortran. here i dont have any issues.
what can i do to compile the code in ivf?
thank you!
0 Kudos
45 Replies
tropfen
New Contributor I
475 Views
Hello,

looking at your suggestions, i would prefer that there will be an automatic cleaning of the stack. I do not know during programing how many files will be opend during execution. Increasing the stack just for care (what i do currently) is not a good solution for me.

Frank
0 Kudos
jimdempseyatthecove
Honored Contributor III
475 Views
mecej4,

You can stay in FORTRAN and get the stack pointer

integer(C_PTR) :: StackLoc
...
StackLoc = LOC(StackLoc)

Place thatat start ofPROGRAM, then copy StackLoc to global InitialStackLock variable.
Then in subroutines, insert the above code. You can then check for stack consumed, but this will not tell you if you are getting close to stack overflow.

There is a C runtime library call that you can call from FORTRAN to obtain the remaining stack. Look in MSDN for the Windows version or in ??? for Linux.

On Windows single threaded there will be a fixed floor such as 0x10000 (verify this). For multi-threaded this will not be the case as each thread has a seperate stack and each stack has a lowest mapped location with guard page below that. On Linux (*ux) your stack grows till some other limiting value.

Jim
0 Kudos
mecej4
Honored Contributor III
475 Views
Jim, thanks for the pointers.

"..but this will not tell you if you are getting close to stack overflow." I thought of reading the .EXE header to obtain the stack limit, but decided that doing so was not worthwhile for a one-off job.
0 Kudos
Steven_L_Intel1
Employee
475 Views
This issue was fixed in 12.0 Update 2.
0 Kudos
Reply