Software Archive
Read-only legacy content
17061 Discussions

Floating point error handling via setjmp,longjmp

dpbozarth
Beginner
262 Views
Anybody been able to do this with CVF? I have a of code porting from Watcom F77 under OS/2 to CVF 6.1a on NT. It traps fp errors and cleans up then returns to keep on running (it's a real-time monitoring application that can't just die....errors are typically caused by not having a piece of data for a particular input for a sample period, for example). The error handling is implemented via C library routines setjmp and longjmp for which Watcom provided Fortran wrappers. CVF does not provide these wrappers and I've run into a couple of snags trying to supply them.

Watcom interface pragmas allow for specification of two things (among a bunch of others) that I've not found a way to specify w/CVF: passing arguments to a routine via registers as opposed to on the stack and an indication that the called routine doesn't return. My questions revolve around these two issues. Since longjmp doesn't return to the caller, the prototype declares the jmp_buf structure (an array of 13 integers) address to be passed via register and the "aborts" pragma causes the compiler to generate a "goto" instruction instead of a "call". The question is, is there any way in CVF to be able to successfully do this? The effort to restructure the error handling is far beyond what can be done now and the realtime nature of the program requires it to continue. I could, I suppose, try simply turning off all fpp exceptions, but that will prevent me from taking the clean up action. Without some useful way around this it seems like I'm forced back to Watcom (and F77, which is not necessarily bad, but I'd like the ability to incorporate more F90/95 features on down the road) The MS C compiler has not yet arrived, so I've not been able to just see if it crashes or flies. But if someone knows it is impossible, I might as well quit and start on the Watcom port....thanks

BTW, Steve, the first question is the same as the support question but I hadn't actually thought of the problem of stack cleanup if don't use register for jump_buf pointer...and figured else must have wanted/needed to do this...
c
0 Kudos
1 Reply
Steven_L_Intel1
Employee
262 Views
I can tell you that CVF has no directive like that, but other than that, I'm leaving it up to our exception handling expert who is assigned your support request.

Steve
0 Kudos
Reply