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
Joseph S. Myers wrote:-
> 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.)
I can easily add a -W option if you like, say -W[no-]div-by-zero. I
prefer to avoid a proliferation of options, though. How about using
it iff -Wall rather than having an extra option? I'll scrap the
floating point warning.
> 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.
Hmm, that's not covered. Any hints on how to get that right?
> The warning would make sense for C++ as well, not just the C front end.
I'll see if I can address this.
Neil.