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: [PING^3] PR 21438 : Warning about division by zero depends on lexical form


Joseph S. Myers wrote:

> The int i = int(1.0/0.0); is a C++ matter, but is not a matter of a 
> division-by-zero warning; rather a matter that we should warn for 
> conversion of any constant infinity or NaN to an integer type, whether 
> that infinity or NaN is obtained by division by zero or by using built-in 
> functions.  This should go with other warnings for out-of-range 
> floating-to-integer conversions.

I don't know that I entirely agree that we should not warn about
1.0/0.0.  In particular, if doing that division would generate a SIGFPE
on the target, were it not folded, then it seems reasonable to warn
about it.

However, what I do agree about is that the C and C++ front-ends should
agree.  Also, as a C++ maintainer, I am happy for the C++ front-end to
be modified to match the C front-end; that consistency is more important
to me than whether or not we warn.  So, I would look favorably on a
patch to factor out whatever logic is used in C and share it with C++.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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