Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Misaligned arguments in static library subroutine call

JonShaw
Beginner
834 Views
My program crashes with a stack overflow error. Any suggestions for what I'm doing wrong would be gratefully received!

Intel Fortran Compiler 11.1 build 054
Windows 7 Professional 64 bit SP1

Stepping through, the first time a problem is apparent is in calling a routine in a static library - the arguments seem to be messed up. The subroutine header is:

[fortran]subroutine getsysindex(sysindex,date,systemformat,sysfilepath,sysnum) type(sysindex_t), intent(in) :: sysindex integer, intent(in) :: date character(*), intent(in) :: systemformat character(255), intent(out) :: sysfilepath integer, intent(out) :: sysnum end subroutine getsysindex[/fortran]

Inside the subroutine (having called it with appropriate arguments), the call stack shows:

[fortran]GEtaxcredits-MultiSys.exe!FORTAX_PRICES::GETSYSINDEX(TYPE(SYSINDEX_T) SYSINDEX={...}, INTEGER(4) DATE=19950407, SYSTEMFORMAT=, .tmp..T938__V$768=,
CHARACTER(255) SYSFILEPATH='', .tmp..T943__V$76b=, INTEGER(4) SYSNUM= Undefined address)
Line 362 Fortran [/fortran]
(I've removed the 255 blank spaces in the SYSFILEPATH argument so that it fits in a reasonable amount of space)

1. Why is the systemformat argument missing?
2. What are the arguments .tmp..T938__V$768 and .tmp..T943__V$76b?
3. Why is sysnum an undefined address?

Thanks very much!
0 Kudos
2 Replies
Lorri_M_Intel
Employee
834 Views
There is very little to go on here, so let me make a few wild guesses.

First, the ".tmp.XXX" variables are the hidden string length. However you compiled the source, caused the string lengths to be passed immediately following the string address. I might have guessed /iface:cvf except that the subroutine name is not decorated.

Second, along that same line, you don't show either the command line or the calling statement. How are you calling getsysindex in the first place? Is it possible that the two things are compiled the same? That is, one is compiled with /iface:cvf and the other is not?

Finally, I'm not sure where this call stack came from -- is it from Visual Studio?

--Lorri
0 Kudos
JonShaw
Beginner
834 Views
Brilliant - you were exactly right. The library had mistakenly been compiled with /iface:cvf.

Thanks very much.
0 Kudos
Reply