This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR 21438 : Warning about division by zero depends on lexical form
On 29/01/07, Dirk Mueller <dmueller@suse.de> wrote:
On Sunday, 14. January 2007 16:16, Manuel López-Ibáñez wrote:
> The C front-end does not warning about division by zero for floating
> point because it is a legitimate way of obtaining infinities and NaNs.
only if division by zero is a real constant, not if it is an integer constant.
> With this patch we don't emit the warning if the integer zero is
> promoted to real type.
.. which is not intended.
Really? Strange. Well, I can turn the patch around and fix the C++
front-end to follow the C front-end.
> The C++ front-end, on the contrary, warns always. Is this an inconsistency?
Yes, I submitted a patch about this a few months ago to fix this, but
unfortunately it was never approved (there was a discussion about it though
where I lerned the difference between 0.0/0.0 and 0.0/0).
>+ 1.0f/0, /* { dg-bogus "division by zero" } */
it *should* warn here.
Could you point me to the discussion or give some hint to find it?
Cheers,
Manuel.