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 have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
29312 Discussions

unexplained exception disappears with /check:pointer or other strange conditions

TheClassic
Beginner
503 Views

(I'm using 10.1.4161.2005)
I have a Fortran library that is called from VC++ and calls several C++ methods. I am changing the interface declarations for calls out to C++ to use ISO_C_BINDING. After making these changes, when running in release an exception occurs in the Fortran code. I tracked it down (by debugging the C++ code) and it seems to occur immediately after returning from the C++ function that is called by my Fortran code. I have found that putting a WRITE statement before and after the function call eliminates the exception. Also setting Omit Frame Pointers to No or using /check:pointer eliminates the problem. The data passed to and from the C++ seems valid.
I have pasted the Fortran interface declaration and C++ function declaration for the function that I am calling in the Fortran code. I can't find any reason why this exception is occuring or why I can make it dissapear using the methods I listed. My understanding of /check:pointer is that it should report a problem so that it can be resolved, not eliminate the problem.

Before:
interface
Integer function PointvectorLOS
& [C, ALIAS:'_PointVectorLOS']
& (Sourcept,Rayvector,MaxHits,NumHits,
& HitIdlist,HitTypelist,Entrypt,Exitpt,EntryNormal,
& ExitNormal, bSkipRubble)

real Sourcept [REFERENCE]
real Rayvector [REFERENCE]
integer MaxHits [VALUE]
integer NumHits [REFERENCE]
integer HitIdlist [REFERENCE]
integer HitTypelist [REFERENCE]
real Entrypt [REFERENCE]
real Exitpt [REFERENCE]
real EntryNormal [REFERENCE]
real ExitNormal [REFERENCE]
logical bSkipRubble [VALUE]

end function PointvectorLOS
end interface

After:
interface
Integer(c_int) function PointvectorLOS
& (Sourcept,Rayvector,MaxHits,NumHits,
& HitIdlist,HitTypelist,Entrypt,Exitpt,EntryNormal,
& ExitNormal, bSkipRubble)
& bind(C,name='PointVectorLOS')
use ISO_C_BINDING

real(c_float) :: Sourcept
real(c_float) :: Rayvector
integer(c_int), VALUE :: MaxHits
integer(c_int) :: NumHits
integer(c_int) :: HitIdlist
integer(c_int) :: HitTypelist
real(c_float) :: Entrypt
real(c_float) :: Exitpt
real(c_float) :: EntryNormal
real(c_float) :: ExitNormal
integer(c_int), VALUE :: bSkipRubble

end function PointvectorLOS
end interface

(I have made the appropriate changes for the change of bSkipRubble from logical to integer.)

C++ declaration:
int PointVectorLOS( float *SourcePt, float *vect, int maxhits, int *NumHits, int *HitIDList,
int *ibHitTypeList, float *EntryPt, float *ExitPt, float *EntryNormal, float *ExitNormal, int bSkipRubble);

0 Kudos
0 Replies
Reply