[Numeric-interest] longjmp from signal handler

Douglas Priest priest at mailhost.sfbay.sun.com
Tue Apr 29 15:13:58 PDT 2008


  >  One item being considered is requiring signal handlers to be able to
  >  do a longjmp(), for at least SIGFPE, and perhaps all signals.
  >  Currently that results in undefined behaviour [C99 7.14.1.1 The signal
  >  function, paragraph 5].
  >  
  >  Does anyone know of an implementation that will break because of this
  >  proposed requirement?

Any implementation on x86 that does not include the floating point
environment (in the x87 sense, not the C99 sense) as part of the
object saved by setjmp() will create a problem in that a user's
SIGFPE handler will have to fix up the x87 stack before calling
longjmp().  Unless C provides a standard, portable way to do that,
I don't see any point in the proposed requirement.  One can already
write non-standard, non-portable code that calls longjmp() from a
signal handler, at least on some platforms.

  >  Does anyone know of any numeric applications need this feature?

If anyone does, please respond to the list or cc me.  Thanks.

Doug Priest


More information about the Numeric-interest mailing list