comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: Run-time checking and speed
Date: 28 Jan 1995 01:03:05 -0500
Date: 1995-01-28T01:03:05-05:00	[thread overview]
Message-ID: <3gcmmp$of@gnat.cs.nyu.edu> (raw)
In-Reply-To: 3g8hpf$pn@rational.rational.com

Kent Mitchell asks why one might need to turn off checks in certified code.
Sure the checks will be executed, but presumably you are doing the checks
so that if the check fails, then you do something.

It is the something that is a problem.

Suppose you do constraint error checking in some routine, just to catch
incorrect input from somewhere else in the program, and you have a handler
that defends against bad input.

How will you do coverage testing of the handler, if in fact, as one might
hope, there aren't any bad calls.

Not only compiler generated checks are the issue here. Suppose you write:

   if x > 10 and y > 10 then

	-- Don't know if this can ever happen, but just in case ...

	y := x - 10; -- readjust to acceptable range
   end if;

such code might be appropriate defensive programming in some situations,
but might cause trouble if certification requires coverage testing. There
are three possibilities in a case like this:

  1. You can find a case where the condition is triggered. Fine trigger it
     for the coverage test.

  2. You can prove it never happens. Fine, remove the check

  3. You can't prove it never happens, all your attempts to find the case
     fail, but you can't complete an actual proof.

Case 3 is the tough one, and shows why coverage testing can sometimes
be a double edged sword.

And I have definitely seen situations in which checking has been disabled
precisely because any code conditioned on the checks is impossible or
difficult to coverage testing.

I am not particuarly defending this state of affairs, or the absolute
requirement for coverage testing, just pointing out the situation :-)




  reply	other threads:[~1995-01-28  6:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-01-10 22:20 Run-time checking and speed Tony Leavitt
1995-01-12  1:14 ` Roger Labbe
1995-01-13 12:09   ` Philip Brashear
     [not found] ` <3f0prq$3bq@theopolis.orl.mmc.com>
1995-01-12 14:13   ` Robert Dewar
1995-01-13  1:49     ` Doug Smith
1995-01-13 15:29       ` Norman H. Cohen
1995-01-13 15:21     ` Norman H. Cohen
     [not found]     ` <3fa2pk$kbi@felix.seas.gwu.edu>
     [not found]       ` <EACHUS.95Jan17151835@spectre.mitre.org>
     [not found]         ` <3fjhrj$9b3@oahu.cs.ucla.edu>
1995-01-20  5:11           ` Robert Dewar
1995-01-23 16:43             ` Mats Weber
1995-01-24 19:25               ` Robert Dewar
1995-01-22 18:43         ` Michael Feldman
1995-01-23 23:38           ` Robert Dewar
1995-01-26 16:14             ` Kent Mitchell
1995-01-28  6:03               ` Robert Dewar [this message]
     [not found]             ` <3gbr4f$p4b@theopolis.orl.mmc.com>
1995-01-29 13:00               ` Robert Dewar
1995-01-30 19:21                 ` Garlington KE
1995-01-12 15:11 ` Norman H. Cohen
  -- strict thread matches above, loose matches on Subject: below --
1995-01-12 15:54 Keith Arthurs
replies disabled

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