This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA] Close PR 150: division by zero
- To: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Subject: Re: [RFA] Close PR 150: division by zero
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Mon, 22 Oct 2001 00:50:56 +0100 (BST)
- cc: <gcc-patches at gcc dot gnu dot org>
On Sun, 21 Oct 2001, Neil Booth wrote:
> This simple patch + testcase closes PR 150, which is a request to warn
> about compile-time division by zero, which can appear in non-obvious
> ways from e.g. macros.
Why a mandatory warning rather than in a -W option? (Division by integer
zero and by floating point zero should be considered separately here -
division by floating point zero may be a reasonable usage to construct a
NaN.)
What does it do for divisions in non-executed code? (Clearly, (FOO == 0 ?
x : y / FOO) should not receive a warning.) The testcase needs to cover
this.
The warning would make sense for C++ as well, not just the C front end.
--
Joseph S. Myers
jsm28@cam.ac.uk