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

C->Fortran call ... Stack overflow? please help

mdanesh1
Beginner
672 Views

Hello,

I'm passing 4 integers as arguments from a C routine to a Fortran routine and I get stack overflow right at the beginning of the Fortran routine. I'm pretty sure thatI haveC and Fortran complier switch mismatch, but I have tried all possible configurations that I can think of and nothing works. Can someone please help me figure outwhich one of my switches is incorrect?

Thanks.

Env: Intel Fortran compiler 8.1, Microsoft VS.net 2003

CCFLAGS: /nologo /GX /GR /Zm1000 /MD /Od /RTC1 /Z7 /W3

FFLAGS: /nologo /Gm /Zl /4L132 /4Ya /libs:dll /threads /fpscomp:all /Zi /Zd /Quse_vcdebug /debug:full /Quppercase

0 Kudos
2 Replies
drgfthomas
Beginner
672 Views

ChangeRTC1 to RTCs and see if it helps; it catches calling convention mismatches

0 Kudos
AONym
New Contributor II
672 Views

The usual cause of this kind of stack overflow is not enough memory for allocation of stack for temporary variables in the subroutine. To see if this is the case, try reducing the size of any large arrays. You can also do this by stepping through the disassembled code starting with the call to the Fortran routine, if you're familiar with this technique.

If it is a case of too much temporary storage required, you can increase the available stack in your project's property pages. For my project, which is mixed C++ and Fortran, this is under Configuration properties/Linker/Systen/Stack reserve size.

0 Kudos
Reply