[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug c/63886] float will fit into int with abs - possible missing warning Wabsolute-value
From:       "manu at gcc dot gnu.org" <gcc-bugzilla () gcc ! gnu ! org>
Date:       2016-07-31 22:44:31
Message-ID: bug-63886-4-KKab4VnZPX () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]

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
----------------------------------------------------------------------------
           Keywords|                            |easyhack

--- Comment #10 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #8)
> (In reply to Andreas Schwab from comment #4)
> > float f = 3.1f;
> 
> Isn't there already -Wunsuffixed-float-constants for warnings with that kind
> of fix?

-Wfloat-conversion is not warning about the lack of suffix, but about the fact
that 3.1 does not fit into a double (3.5 does, so there is no warning).

float f;
double d;

f = 3.100000000000000088817841970012523233890533447265625; // 
-Wfloat-conversion -Wunsuffixed-float-constants
d = 3.100000000000000088817841970012523233890533447265625; //
-Wunsuffixed-float-constants (not sure why!)
f = 3.5; // -Wunsuffixed-float-constants 
d = 3.5; // -Wunsuffixed-float-constants (not sure why!)
f = 3.1f; // no warning
d = 3.1f; // no warning=
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic