comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <nholsti@icon.fi>
Subject: Re: Fortran or Ada?
Date: 1998/10/03
Date: 1998-10-03T00:00:00+00:00	[thread overview]
Message-ID: <3615E297.57D3ED15@icon.fi> (raw)
In-Reply-To: 19980929.214309.386@yktvmv.watson.ibm.com

jbs@yktvmv.watson.ibm.com wrote:
> 
> In article <wclodius-2909981741110001@clodius.lanl.gov>,
>  on Tue, 29 Sep 1998 17:41:11 -0600,
>  wclodius@lanl.gov (William B. Clodius) writes (in part):
> >In article <19980928.184428.604@yktvmv.watson.ibm.com>,
> >jbs@yktvmv.watson.ibm.com wrote:
> >>          2.  It appears there is no cheap way of turning off conversion
> >> error checking in Ada, tempting programmers to leave it active in
> >> inappropriate places.
> >> <snip>
> >
> >While the default is to check errors, it is easy to identify postential
> >sources and turn them off. Note the programmers did that in several
> >cases, and deliberately chose not to do that in this case.
> >
> >See
> >
> >http://www.rvs.uni-bielefeld.de/~ladkin/Reports/ariane.html
> 
>          The accident report indicates that they deliberately
> chose not to do it in this case because they were worried about
> performance.  This would seem to indicate that turning off the
> error check is not cheap (in terms of performance).
>                   James B. Shearer

This discussion of "turning off error checks" seems to assume that the
culprit in the Ariane-501 accident was the run-time checking and
exception
handling required by Ada. This is probably not the case.

As I understand it (without having seen the Ada code, though), what
occurred was that the Ada code called for a type conversion from float
to integer, I := integer(F); the Ada compiler translated this into a
machine instruction; the machine instruction caused a machine trap since
the floating operand was too large; the trap handler (in this
application)
assumed a hardware error and shut down the computer. The trap would
as well have occurred in a Fortran program, assuming that the Fortran
compiler used the same machine instruction, as seems likely.

I suspect that the Ada-defined run-time checks were turned off by
pragma or compiler option, since this is common in space-related
software. The trap could probably have been masked (in hardware), or a
no-operation trap handler used, at no performance overhead. This was not
done because the designers wanted to detect overflow traps as symptoms
of errors, causing a switch to the redundant system.

The "protection" spoken of probably means nesting the conversion in an
explicit range check, to prevent the trap from occurring:

    if (F is in the acceptable range) then
       I := integer(F);
    else
       (do some recovery, eg. set I to a boundary value, or
       trigger a switch to the redundant system)
    end if;

Such "protection" obviously adds some processing load. The designers
analysed the range of F and found that (for Ariane 4) there was no
risk of exceeding the acceptable range, and therefore no need for
this "protection".

If Ada checks were enabled, the same "protection" could have been coded
as

    begin
       I := integer(F);
    exception
       when Constraint_Error => (do some recovery)
    end;

The processing cost of this solution depends on the Ada implementation.
Present-day implementations seem to favour a zero cost for the
"no exception" case, with perhaps a larger cost when the exception
is raised. There may be some cost in translating the machine trap into
the Ada Constraint_Error exception.

If this interpretation of the A-501 report is correct, the Ada-defined
run-time checks and exception handling are definitely not to blame for
the accident, since they played no role in it.

If the interpretation is wrong, and Ada exceptions were used, in my view
the fault was in the poor specification and careless reuse rather than
in the Ada exception mechanism, which did what it was asked to do.

The above comment, in part speculative, is based only on the public
A-501 report and on my experience with space software; I don't have
access to the A-501 Ada code.

Niklas Holsti
Space Systems Finland Ltd
(This message reflects personal opinion, not Space Systems Finland
policy)




  parent reply	other threads:[~1998-10-03  0:00 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <36068E73.F0398C54@meca.polymtl.ca>
1998-09-22  0:00 ` Fortran or Ada? Gisle S{lensminde
1998-09-22  0:00   ` Jeff Templon
1998-09-22  0:00     ` dewarr
1998-09-23  0:00       ` Jeff Templon
1998-09-23  0:00         ` Corey Minyard
1998-09-24  0:00           ` Joel Seidman
1998-09-24  0:00           ` Craig Burley
1998-09-25  0:00             ` dewarr
1998-09-25  0:00               ` Jonathan Guthrie
1998-09-26  0:00               ` Craig Burley
1998-09-26  0:00                 ` dewarr
1998-09-26  0:00                   ` Craig Burley
1998-09-26  0:00                   ` Robert B. Love 
1998-09-24  0:00         ` Marc A. Criley
1998-09-24  0:00           ` Jeff Templon
1998-09-25  0:00             ` dewarr
1998-09-25  0:00             ` Dale Stanbrough
1998-09-30  0:00               ` Daniel Barker
1998-09-30  0:00                 ` Lawrence Kirby
1998-10-01  0:00                   ` Aaron Crane
1998-10-02  0:00                 ` Fortran or Ada or gobbledygook? Wes Groleau
1998-10-05  0:00                 ` Fortran or Ada? Terry Devine
1998-09-24  0:00           ` dewarr
1998-09-24  0:00             ` Robert I. Eachus
1998-09-24  0:00               ` William Clodius
1998-09-25  0:00                 ` dewarr
1998-09-25  0:00               ` dewarr
1998-09-25  0:00                 ` Robert I. Eachus
1998-09-25  0:00                   ` dewarr
1998-09-25  0:00             ` jbs
1998-09-26  0:00               ` dewarr
1998-09-28  0:00                 ` jbs
1998-09-29  0:00                   ` Dean F. Sutherland
1998-09-29  0:00                   ` Gautier.DeMontmollin
1998-09-29  0:00                   ` Dean F. Sutherland
1998-09-29  0:00                   ` William B. Clodius
1998-09-30  0:00                     ` jbs
1998-09-30  0:00                       ` William Clodius
1998-09-30  0:00                       ` dewarr
1998-09-30  0:00                         ` jbs
1998-09-30  0:00                           ` William Clodius
1998-10-03  0:00                       ` Niklas Holsti [this message]
1998-10-03  0:00                         ` Toon Moene
1998-10-03  0:00                           ` Niklas Holsti
1998-10-03  0:00                             ` Toon Moene
1998-10-04  0:00                               ` Niklas Holsti
1998-10-05  0:00                                 ` Michel OLAGNON
1998-10-05  0:00                                   ` Ian St. John
1998-10-05  0:00                                     ` dewarr
1998-10-05  0:00                                       ` Ian St. John
1998-10-06  0:00                                         ` dewarr
1998-10-06  0:00                                           ` James Giles
1998-10-06  0:00                                             ` Mark A Biggar
1998-10-06  0:00                                               ` James Giles
1998-10-07  0:00                                                 ` dewarr
1998-10-07  0:00                                             ` dewarr
1998-10-06  0:00                                           ` Toon Moene
1998-10-06  0:00                                             ` Jonathan Guthrie
1998-10-06  0:00                                           ` Ian St. John
1998-10-08  0:00                                             ` Offtopic Airport Diversion (Was: Fortran or Ada?) Harold Stevens ** PLEASE SEE SIG **
1998-10-08  0:00                                               ` Ian St. John
1998-10-08  0:00                                             ` Fortran or Ada? Gary L. Scott
1998-10-05  0:00                                     ` Richard D Riehle
1998-10-05  0:00                                       ` dewarr
1998-10-06  0:00                                     ` Michel OLAGNON
1998-10-07  0:00                                       ` Ian St. John
1998-09-29  0:00                   ` Dean F. Sutherland
1998-10-02  0:00                   ` Robert I. Eachus
1998-10-02  0:00                     ` jbs
1998-10-02  0:00                       ` William Clodius
1998-10-03  0:00                         ` jbs
1998-10-03  0:00                           ` Larry Elmore
1998-10-06  0:00                           ` Robert I. Eachus
1998-10-06  0:00                             ` Pat Rogers
1998-10-02  0:00                   ` Geoff Bull
     [not found]           ` <6udre0$ha1$1@nnrp1.dejane <6utg60$h6l$1@nnrp1.dejanews.com>
1998-10-01  0:00             ` robin_v
1998-09-22  0:00     ` Corey Minyard
1998-09-22  0:00     ` Larry Kilgallen
1998-09-22  0:00     ` Rakesh Malhotra
1998-09-23  0:00     ` Frank Ecke
1998-09-23  0:00   ` bglbv
1998-09-23  0:00     ` Robert I. Eachus
1998-09-24  0:00       ` Richard D Riehle
1998-09-23  0:00 Marin David Condic, 561.796.8997, M/S 731-96
  -- strict thread matches above, loose matches on Subject: below --
1998-09-23  0:00 Marin David Condic, 561.796.8997, M/S 731-96
1998-09-23  0:00 ` Gisle S{lensminde
1998-09-24  0:00   ` John McCabe
1998-09-24  0:00     ` Gisle S{lensminde
1998-09-24  0:00     ` Dean F. Sutherland
1998-09-24  0:00 ` Samuel T. Harris
1998-09-24  0:00 Walt Brainerd
1998-09-25  0:00 ` Robert I. Eachus
1998-09-25  0:00 ` dewarr
1998-10-05  0:00 Robert I. Eachus
1998-10-05  0:00 robin
1998-10-05  0:00 Condic, Marin D.
replies disabled

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