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: [PATCH] Fix C++ -Wno-div-by-zero


Dirk Mueller wrote:

>>There's a difference here from the C behavior: 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.  (Not a
>>problem with this patch, since it's a pre-existing condition.)
>  
> Yes, should we consolidate that?

Yes, that would be an improvement.  I have no strong opinion about
whether or not a warning is appropriate in that case, but I think it
would be better for the C and C++ front ends to match.

> 2006-02-02  Dirk Mueller  <dmueller@suse.com>
> 
> 	* c.opt: C++ frontend supports -Wdiv-by-zero.
> 	* c-opts.c (c_common_handle_option): Remove dead case.
> 
>         * typeck.c (build_binary_op): Annotate div-by-zero
> 	warnings to make -Wno-div-by-zero have an effect.
> 
> 	g++.dg/warn/Wdiv-by-zero.C: New test.
> 	g++.dg/warn/Wno-div-by-zero.C: New.

OK, 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]