Bryan said:
Something more graceful then core dump.
That's not very specific, is it?
I posed the question because a core dump is usually
the best and most desirable outcome in a case like this.
Consider: There's not much corrective action you can
safely take, because there's no reason to believe the
bad pointer you've detected is the first bad pointer
the program has used. It may well have scribbled all
over memory before you had a chance to notice, and it
would be perilous to proceed on the basis of information
already known to be suspect. All you know is that the
program has gone off the rails, and badly -- a hard stop
will at least prevent the amok program from doing further
damage to disk files and the like, and a hard stop with
a core dump to facilitate post-mortem analysis is usually
welcome.
<off-topic>
A similar situation arises in multi-threaded programs,
where people are always asking how to respond to SIGSEGV
by terminating "only the offending thread" instead of the
entire process. Usually, they haven't really thought
about the situation.
</off-topic>
... and that's why I asked the question: to see if
you'd actually thought it through, and if so what you
expected to do about error recovery. "Something more
graceful than a core dump" doesn't give me a warm fuzzy
feeling about how much thought you've given the matter,
although I could be wrong about that. What are your
intentions?