From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,4609473706965528 X-Google-Attributes: gidf7344,public X-Google-Thread: 10f8a1,4609473706965528 X-Google-Attributes: gid10f8a1,public X-Google-Thread: fc7fa,4609473706965528 X-Google-Attributes: gidfc7fa,public X-Google-ArrivalTime: 1994-04-22 08:20:54 PST Xref: gmd.de comp.os.vms:44914 vmsnet.alpha:1742 Path: gmd.de!nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!udel!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!vixen.cso.uiuc.edu!sdd.hp.com!col.hp.com!csn!decwrl!pa.dec.com!jac.zko.dec.com!quark.enet.dec.com!lionel From: lionel@quark.enet.dec.com (Steve Lionel) Newsgroups: comp.os.vms,vmsnet.alpha,comp.sys.vms Subject: Re: Fortran Exception handler for OpenVMS/Alpha needed Date: 22 Apr 1994 15:20:54 GMT Organization: Digital Equipment Corporation, Nashua NH Distribution: world Message-ID: <2p8q0m$9mq@jac.zko.dec.com> References: <1994Apr21.075434.14408@amoco.com> Reply-To: lionel@quark.enet.dec.com (Steve Lionel) NNTP-Posting-Host: QUARK X-Newsreader: mxrn 6.18-16 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"