This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFA] Close PR 150: division by zero


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]