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]
Other format: [Raw text]

Re: PR 21438 : Warning about division by zero depends on lexical form


On 29/01/07, Mark Mitchell <mark@codesourcery.com> wrote:
Manuel López-Ibáñez wrote:

> 2007-01-14  Andrew Pinski  <pinskia@gmail.com>
>                    Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
>
>  PR c/21438
>  * gcc/c-typeck.c (build_binary_op): Don't give division by zero
> warning if integer zero is promoted to REAL_TYPE.
>
> testsuite:
> 2007-01-14  Andrew Pinski  <pinskia@gmail.com>
>                    Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
>
>  PR c/21438
>  * gcc.dg/Wdiv-by-zero.c: New.

I'll let a C maintainer review these bits.


It seems that, as Dirk explains, this is actually the intended behaviour:


Joseph says: "the C front end doesn't
warn for division by a floating point zero constant (although it warns for
division of a floating point value by an integer zero) since explicit
division by 0.0 is used as a way of generating Inf and NaN."
http://gcc.gnu.org/ml/gcc-patches/2006-01/msg02184.html

So I think that the PR is invalid and thus this patch is useless. :-(

Am I wrong?

Manuel.


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