https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63886

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #9 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to David Binderman from comment #6)
> (In reply to Marek Polacek from comment #5)
> > Seems like there's nothing to do for this bug.
> 
> Suggest there are two cases
> 
> 1. double to float

Note that 3.1 and 3.1f are not the same number:

  double d1 = 3.100000000000000088817841970012523233890533447265625e+0;
  float f1 = 3.099999904632568359375e+0;

and the former does not fit in 'float' (if it fits, we do not warn).

> 2. double or float into any integer type.
> 
> The one warning, produced by -Wfloat-conversion, could be
> split into two warnings, as per the two cases.

-Wfloat-to-int-conversion?

Should it warn for vfloat = 16777217;  ?

If so, perhaps we need another name.

> #1 isn't very useful, #2 seems useful to me.
> 
> Then put case #1 into -Wall.

case #2 ? 

I guess useful is in the eye of the beholder. The whole reason why I added
-Wconversion more than 10 years ago was precisely to track lossy
float-to-double and double-to-float conversions in a project of mine.

Reply via email to