Usenet comp.sys.vms (1990-2004)
 help / color / mirror / Atom feed
From: lionel@quark.enet.dec.com (Steve Lionel)
Subject: Re: Fortran Exception handler for OpenVMS/Alpha needed
Date: 22 Apr 1994 15:20:54 GMT	[thread overview]
Message-ID: <2p8q0m$9mq@jac.zko.dec.com> (raw)
In-Reply-To: 1994Apr21.075434.14408@amoco.com


In article <1994Apr21.075434.14408@amoco.com>, zmjl19@NAP.AMOCO.COM 
(Michael J. Liebman) writes:
|>
|>We have the need to trap exceptions on an OpenVMS Alpha.  In
|>particular, we are trying to trap fortran exceptions such as overflow,
|>underflow, square root of a negative number, etc.  We'd like handle
|>the errors in a relatively clean way which allows continuing if
|>desired.  We have a subroutine (originally from DOE-Morgantown) which
|>works for VAX/VMS but is not compatible with Alpha.  Does anyone have
|>an equivalent fortran subroutine for the Alpha?

It's not that simple.  Exception handling for "hardware-detected errors"
is dramatically different on Alpha AXP as compared to VAX.  The most
significant aspect is that, by default, the exception may not get generated
until some number of instructions later and your handler is not given the
precise PC of the instruction at fault.  The architecture does provide
methods for backtracking to find the errant instruction, but this also
requires that the compiler generate different (and slower) code to
accomodate it.

My first suggestion is to modify the program to pre-test input values so as
to avoid overflows, underflows, etc.  If this is not feasible, then isolate
the operations which might get errors into separate functions; have that
function establish a handler which returns a desired result if an error
occurs (the compilers do make sure that any exceptions are raised before
a routine exits.)

If your VAX handler calls routines like LIB$SIM_TRAP and LIB$FIXUP_FLT,
you have to rethink how this is handled on Alpha AXP.

I'm not sure how math library errors are handled - perhaps someone else
can comment.

In OpenVMS V6.1, the C and Fortran compilers can operate in IEEE floating
modes which give you special "NaNs" (Not-a-Numbers) for overflow,
denormalized values for underflow, etc.  Using these extracts a large
performance penalty.
-- 

Steve Lionel                      Mail: lionel@quark.enet.dec.com
SDT Languages Group               WWW:  http://www.digital.com/info/slionel.html
Digital Equipment Corporation     
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698             "Free advice is worth every cent"


      reply	other threads:[~1994-04-22 15:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-04-21 12:54 Fortran Exception handler for OpenVMS/Alpha needed Michael J. Liebman
1994-04-22 15:20 ` Steve Lionel [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox