This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Pathalogical divides
- To: dewar at gnat dot com
- Subject: Re: Pathalogical divides
- From: Geoff Keating <geoffk at cygnus dot com>
- Date: Sun, 24 Sep 2000 23:27:36 -0700
- CC: kenner at vlsi1 dot ultra dot nyu dot edu, gcc at gcc dot gnu dot org
- References: <20000925060704.18ACD34DB0@nile.gnat.com>
> Cc: gcc@gcc.gnu.org
> Date: Mon, 25 Sep 2000 02:07:04 -0400 (EDT)
> From: dewar@gnat.com (Robert Dewar)
>
> <<Yes. C interpreters are permitted to do anything they like when
> signed integer arithmetic overflows, including producing a signal.
> >>
>
> Actually while I think that is a valid interpretation of K&R rules,
> it is VERY difficult to read the ANSI standard this way, check out
> the exact wording, which seems to imply that the result is implementation
> defined within certain limits, but I cannot read it to allow a signal.
???
It says, in s. 6.5 paragraph 5 of ISO/IEC 9899:1999:
If an _exceptional condition_ occurs during the evaluation of an
expression (that is, if the result is not mathematically defined or
not in the range of representable values for its type), the behaviour
is undefined.
'undefined behaviour' can always include a signal, or anything else
that a mad compiler designer could dream up.
--
- Geoffrey Keating <geoffk@cygnus.com>