[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: standards on SIGFPE for divide by zero
On Thu, Mar 03, 2011 at 07:32:03AM -0500, Steven Bellovin wrote:
> On Mar 3, 2011, at 2:12 18AM, Ignatios Souvatzis wrote:
> > On Wed, Mar 02, 2011 at 02:59:32PM -0500, Thor Lancelot Simon wrote:
> >> You want the program to get a floating-point-exception signal on a bad
> >> integer divide?
> > Uh, it's been a generic arithmetic error signal for a long time, like
> > ENOTTY complaining about generic wrong-type-of-file-descriptor situations.
> > I was surprised by that a couple of years ago.
> > SUSV3 defines:
> > SIGFPE A Erroneous arithmetic operation.
> > ...
> > SIGFPE FPE_INTDIV Integer divide by zero.
> > FPE_INTOVF Integer overflow.
> > FPE_FLTDIV Floating-point divide by zero.
> > (...)
> > Now, if the hardware in question can't create SIGFPE on integer divide,
> > I don't think we should torture the compiler into simulating it.
> What does the C standard say? Is the exception required?
C'99 TC3 says in 7.14, page 246, paragraph 4:
"An implementation need not generate any of these signals, except
as a result of explicit calls to the raise function."
(where the list is SIGABRT, SIGILL, SIGFPE, SIGINT, SIGSEGV,
SIGTERM, and additionally defined signal numbers are allowed).
Main Index |
Thread Index |