Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #98507

Re: Mars lander crash

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: Mars lander crash
Date 2016-12-09 15:46 +0100
Organization A noiseless patient Spider
Message-ID <o2eg20$b90$1@dont-email.me> (permalink)
References <o2e7s1$ea6$1@dont-email.me> <o2e8sg$hp7$1@dont-email.me> <o2ecu8$v73$1@dont-email.me> <o2eel2$614$1@dont-email.me>

Show all headers | View raw


On 09/12/16 15:22, Richard Heathfield wrote:
> On 09/12/16 13:53, David Brown wrote:
>> On 09/12/16 13:44, Richard Heathfield wrote:

<snip the bits we are clear on>

>>> If that's what went wrong (and it's not entirely clear whether an
>>> overflow was responsible, but let's assume it was), then that is clear
>>> evidence of inadequate testing of the software. In such circumstances,
>>> an implementation that tests every operation for overflow would have
>>> been an invaluable testing tool.
>>
>> I agree about inadequate testing of the software.  I don't agree that
>> testing all operations for overflow is helpful.  That merely introduces
>> a vast number of code paths that cannot be taken, cannot be tested, and
>> cannot be verified.
> 
> I don't see how you derive that conclusion from what I wrote. Let us
> assume that, /without/ overflow checking, we have a battery of, say, a
> million tests. (This is rocket science, after all. But it's just a
> number. Don't get hung up on it.) And these million tests can be run in,
> say, a week. I see no harm, and some gain, in adding overflow checking
> during these existing tests. Cost? Maybe it runs in 169 hours instead of
> 168. No big deal. Potential value in terms of discovering an otherwise
> hidden overflow? Possibly considerable. It's not something I would turn
> down unless there were a very good reason to turn it down.

In the tests without overflow checking, you have code like this:

	if (a) {
		x = y + z;
	}

This gives you two paths to check, one of which involves a calculation.

If you add overflow checking, you have this:

	if (a) {
		x = y + z;
		if (overflow) {
			doSomethingAboutTheOverflow();
		}
	}

For every calculation with overflow checking, you have added another
code path to check.  If you have not gone down that path, your tests
don't have full coverage of the code you have written.

If the action on overflows is all the same - jump to safe mode, deploy
parachutes and airbags, panic, prey, say your last farewells - then it
is possible that the testing is feasible if you have some way to
artificially inject overflows in code that you know cannot possible
/have/ overflows.  But if the action on overflows is a recovery, or an
exception-type mechanism, then you have hugely multiplied up the number
of possible code paths in each function.  Your cyclomatic complexity
goes through the roof, and instead of /adding/ an hour to your test, you
are multiplying it by 2 to the power of the number of calculations in a
function.


> 
>> In a system that needs to be safe and reliable, you
>> do not put in extra code (explicitly by the programmer, or implicitly
>> via the tools) that you cannot test and do not need.  (You do put in
>> extra checks at boundary points between modules, but you limit these and
>> check them independently.)
> 
> Not in the production code, no. But for testing, I would disagree.
> Adding extra code can pay off during the debugging and test phases.
> Assertions are an obvious example.

Yes, more code (such as asserts) can be useful during early testing -
the sooner you find the bugs, the better.

For your long-term testing, of course, you use the production version.

(These kinds of tests may run in parallel to some extent.)

> 
>>>> The lander then, thinking it had already landed, stopped the rocket
>>>> motors and started the sequence for after the landing, hitting the
>>>> ground at more than 200 Km per hour.
>>>>
>>>> Overflows are dangerous stuff.
>>>
>>> Right. Nobody is disputing that, are they?
>>
>> Not that I can see.  Even though I am arguing against hidden
>> compiler-based overflow detection, except perhaps as a debugging tool
>> during development, I agree that overflows are dangerous.  That is why I
>> say they should be avoided, not detected.
> 
> Yes, but where is the harm in detecting them anyway (during testing)? If
> you find one, you know you didn't avoid it! And that's useful
> information to the developer.
> 

Agreed - overflow detection is a debugging tool.  At the risk of causing
another explosion, tools such as gcc/clang's
"-fsanitize=signed-integer-overflow" can definitely be useful in
spotting bugs during development and testing.


Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-09 13:26 +0100
  Re: Mars lander crash Richard Heathfield <rjh@cpax.org.uk> - 2016-12-09 12:44 +0000
    Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-09 14:53 +0100
      Re: Mars lander crash already5chosen@yahoo.com - 2016-12-09 05:58 -0800
        Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-09 15:11 +0100
        Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-09 16:56 +0100
          Re: Mars lander crash supercat@casperkitty.com - 2016-12-09 08:51 -0800
          Re: Mars lander crash already5chosen@yahoo.com - 2016-12-11 02:23 -0800
            Re: Mars lander crash Gareth Owen <gwowen@gmail.com> - 2016-12-11 10:57 +0000
          Re: Mars lander crash "James R. Kuyper" <jameskuyper@verizon.net> - 2016-12-11 12:34 -0500
            Re: Mars lander crash Robert Wessel <robertwessel2@yahoo.com> - 2016-12-11 23:33 -0600
      Re: Mars lander crash Richard Heathfield <rjh@cpax.org.uk> - 2016-12-09 14:22 +0000
        Re: Mars lander crash asetofsymbols@gmail.com - 2016-12-09 06:30 -0800
          Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-09 15:48 +0100
        Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-09 15:46 +0100
          Re: Mars lander crash Richard Heathfield <rjh@cpax.org.uk> - 2016-12-09 14:55 +0000
            Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-09 16:08 +0100
              Re: Mars lander crash Richard Heathfield <rjh@cpax.org.uk> - 2016-12-09 15:52 +0000
          Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-09 17:35 +0100
            Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-09 18:35 +0100
              Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-09 19:10 +0100
                Re: Mars lander crash "James R. Kuyper" <jameskuyper@verizon.net> - 2016-12-09 19:18 -0500
                Re: Mars lander crash Keith Thompson <kst-u@mib.org> - 2016-12-09 16:49 -0800
                Re: Mars lander crash "J. Clarke" <j.clarke.873638@gmail.com> - 2016-12-20 20:03 -0500
                Re: Mars lander crash <william@wilbur.25thandClement.com> - 2016-12-09 22:04 -0800
                Re: Mars lander crash supercat@casperkitty.com - 2016-12-10 10:59 -0800
                Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-11 13:22 +0100
                Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-11 14:18 +0100
                Re: Mars lander crash already5chosen@yahoo.com - 2016-12-11 06:03 -0800
                Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-11 15:08 +0100
                Re: Mars lander crash already5chosen@yahoo.com - 2016-12-11 06:20 -0800
                Re: Mars lander crash luser droog <luser.droog@gmail.com> - 2016-12-11 07:08 -0800
                Re: Mars lander crash Keith Thompson <kst-u@mib.org> - 2016-12-11 11:56 -0800
                Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-11 21:05 +0100
                Re: Mars lander crash jameskuyper@verizon.net - 2016-12-11 12:57 -0800
                Re: Mars lander crash Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-11 21:26 +0000
                Re: Mars lander crash supercat@casperkitty.com - 2016-12-11 09:23 -0800
                Re: Mars lander crash Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-11 14:01 +0000
                Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-11 15:11 +0100
                Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-11 18:57 +0100
                Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-11 19:23 +0100
                Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-11 19:55 +0100
                Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-11 20:52 +0100
                Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-11 23:37 +0100
                Re: Mars lander crash supercat@casperkitty.com - 2016-12-11 16:10 -0800
                Re: Mars lander crash BartC <bc@freeuk.com> - 2016-12-12 01:13 +0000
                Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-12 09:53 +0100
                Re: Mars lander crash supercat@casperkitty.com - 2016-12-12 08:30 -0800
                Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-12 09:25 +0100
                Re: Mars lander crash supercat@casperkitty.com - 2016-12-11 10:36 -0800
                Re: Mars lander crash Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-11 18:46 +0000
                Re: Mars lander crash supercat@casperkitty.com - 2016-12-11 09:12 -0800
                Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-11 18:53 +0100
                Re: Mars lander crash Keith Thompson <kst-u@mib.org> - 2016-12-11 12:09 -0800
                Re: Mars lander crash Jean-Marc Bourguet <jm@bourguet.org> - 2016-12-11 21:30 +0100
                Re: Mars lander crash Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-12-11 15:50 -0500
                Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-11 23:02 +0100
                Re: Mars lander crash Keith Thompson <kst-u@mib.org> - 2016-12-11 18:29 -0800
                Re: Mars lander crash Keith Thompson <kst-u@mib.org> - 2016-12-11 12:03 -0800
                Re: Mars lander crash Keith Thompson <kst-u@mib.org> - 2016-12-11 11:55 -0800
                Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-11 23:42 +0100
                Re: Mars lander crash Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-11 14:53 -0800
                Re: Mars lander crash Ian Collins <ian-news@hotmail.com> - 2016-12-12 17:09 +1300
                Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-12 10:00 +0100
                Re: Mars lander crash Ian Collins <ian-news@hotmail.com> - 2016-12-12 22:20 +1300
                Re: Mars lander crash Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-12 01:28 -0800
                Re: Mars lander crash Ian Collins <ian-news@hotmail.com> - 2016-12-12 22:38 +1300
                Re: Mars lander crash Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-12 02:43 -0800
                Re: Mars lander crash Ian Collins <ian-news@hotmail.com> - 2016-12-13 08:20 +1300
                Re: Mars lander crash Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-12 12:57 -0800
                Re: Mars lander crash Ian Collins <ian-news@hotmail.com> - 2016-12-13 14:14 +1300
                Re: Mars lander crash Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-13 01:19 -0800
                Re: Mars lander crash Ian Collins <ian-news@hotmail.com> - 2016-12-13 22:56 +1300
                Re: Mars lander crash Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-13 05:16 -0800
                Re: Mars lander crash Ian Collins <ian-news@hotmail.com> - 2016-12-14 18:05 +1300
                Re: Mars lander crash Keith Thompson <kst-u@mib.org> - 2016-12-13 08:19 -0800
                Re: Mars lander crash Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-13 17:01 +0000
                Re: Mars lander crash Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-13 10:48 -0800
                Re: Mars lander crash Geoff <geoff@invalid.invalid> - 2016-12-13 11:56 -0800
                Re: Mars lander crash Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-13 13:37 -0800
                Re: Mars lander crash Geoff <geoff@invalid.invalid> - 2016-12-13 19:11 -0800
                Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-13 20:13 +0100
                Re: Mars lander crash supercat@casperkitty.com - 2016-12-13 11:45 -0800
                Re: Mars lander crash Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-13 23:10 +0000
                Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-14 10:18 +0100
                Re: Mars lander crash Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-14 12:37 +0000
                Re: Mars lander crash Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-14 21:31 -0800
                Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-15 13:26 +0100
                Re: Mars lander crash Ian Collins <ian-news@hotmail.com> - 2016-12-12 22:40 +1300
                Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-12 13:22 +0100
                Re: Mars lander crash supercat@casperkitty.com - 2016-12-12 08:35 -0800
        Re: Mars lander crash supercat@casperkitty.com - 2016-12-09 08:43 -0800
      Re: Mars lander crash Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-09 09:47 -0500
        Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-09 16:11 +0100
          Re: Mars lander crash Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-09 10:49 -0500
  Re: Mars lander crash already5chosen@yahoo.com - 2016-12-09 05:53 -0800
    Re: Mars lander crash asetofsymbols@gmail.com - 2016-12-09 06:04 -0800
      Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-09 15:09 +0100
        Re: Mars lander crash Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-09 10:06 -0500
          Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-09 16:32 +0100
    Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-09 17:30 +0100
      Re: Mars lander crash BartC <bc@freeuk.com> - 2016-12-09 16:42 +0000
      Re: Mars lander crash Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-12-09 11:43 -0500
      Re: Mars lander crash Keith Thompson <kst-u@mib.org> - 2016-12-09 08:59 -0800
      Re: Mars lander crash "J. Clarke" <j.clarke.873638@gmail.com> - 2016-12-20 19:36 -0500
  Re: Mars lander crash "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2016-12-09 06:46 -0800
    Re: Mars lander crash Richard Heathfield <rjh@cpax.org.uk> - 2016-12-09 14:57 +0000
      Re: Mars lander crash Noob <root@127.0.0.1> - 2016-12-09 16:07 +0100
    Re: Mars lander crash David Brown <david.brown@hesbynett.no> - 2016-12-09 16:03 +0100
      Re: Mars lander crash "James R. Kuyper" <jameskuyper@verizon.net> - 2016-12-09 12:41 -0500
    Re: Mars lander crash Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-09 10:52 -0500
      Re: Mars lander crash jameskuyper@verizon.net - 2016-12-09 12:13 -0800
        Re: Mars lander crash jacobnavia <jacob@jacob.remcomp.fr> - 2016-12-09 21:56 +0100
          Re: Mars lander crash jameskuyper@verizon.net - 2016-12-09 14:11 -0800
        Re: Mars lander crash Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-09 22:46 -0500
          Re: Mars lander crash <william@wilbur.25thandClement.com> - 2016-12-09 22:34 -0800
          Re: Mars lander crash James Kuyper <jameskuyper@verizon.net> - 2016-12-10 18:38 -0500
      Re: Mars lander crash Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-11 06:06 -0800
  Re: Mars lander crash "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-12-10 01:17 +0800
  Re: Mars lander crash Ken Brody <kenbrody@spamcop.net> - 2016-12-13 14:28 -0500
  Re: Mars lander crash Ken Brody <kenbrody@spamcop.net> - 2016-12-13 14:30 -0500

csiph-web