[M3devel] SEGV mapping to RuntimeError

Jay K jay.krell at cornell.edu
Sun Feb 20 01:26:30 CET 2011


NIL might be a special case.
But by and large, continuing to do anything after a SIGSEGV is a bad idea.
You think (you say) you are continuing on and preserving state, but the state
of the world is now arbitrarily altered and unknown and all future computation
based on it is suspect. Best to throw it away. And avoid incorrect results
when there is a such a strong hint that things have gone awry.
 
 
In the Windows C programming world, you can catch access violatios (SIGSEGV)
very easily with __except. But prevailing wisdom now and for a long time is
exactly what I'm saying -- that catching and continuing isn't "robust", it is letting
the damage of bugs continue further.
 
 
I'm undecided as to the level of guarantees of the safety guarantees, given
the surrounding unsafe world. I believe safety depends on a lack of bugs
in certain places, certain fairly large places, and therefore the safety
guarantees should be considered significant and useful, but not absolute.
 
 
There really are bugs everywhere. In the compiler (Modula-3, C, etc.),
in the C runtime, in the kernels, in the CPUs.
Recent AMD processors have a bug in integer division even..one of the
most surprising things I've seen in a long time..
(really, recent processors, integer division, I'm not talking about the ancient
Pentium FDIV bug).
There is a published errata for it and it has been fixed.
But I managed to hit it in my code..
 
 
 - Jay
 
> To: jay.krell at cornell.edu
> Date: Sat, 19 Feb 2011 16:13:14 -0800
> From: mika at async.caltech.edu
> CC: m3devel at elegosoft.com
> Subject: Re: [M3devel] SEGV mapping to RuntimeError
> 
> Jay K writes:
> >--_1802b75d-f353-43c9-bd6c-02a34e2b7ae8_
> >Content-Type: text/plain; charset="iso-8859-1"
> >Content-Transfer-Encoding: quoted-printable
> >
> >
> >Modula-3 doesn't live in a vacuum.
> >The vast majority of surrounding code is C and C++.
> >There are bugs everywhere.
> > - Jay
> 
> It's rather up to the programmer using it, isn't it? If you write your
> code in pure Modula-3, you should be able to rely on the guarantees of
> the Green Book (and therefore that SIGSEGV means something relatively
> specific, not that "the world just ended"). If you insist on linking
> with broken C and C++... well you get what you deserve, probably best
> not to try to handle RuntimeError.E in that case.
> 
> In any case, to an interactive user of my Scheme interpreter it is very
> useful that a NIL dereference drops him at the read-eval-print loop
> rather than killing the world. E.g., if as I had yesterday, a 1-gigabyte
> datastructure parsed in memory, and I lost the world because I happened
> to try to set-car! on a null list somewhere.
> 
> Mika
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20110220/35bf9bfe/attachment-0002.html>


More information about the M3devel mailing list