This is the mail archive of the gcc-bugs@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]

[Bug fortran/47659] -Wconversion[-extra] should emit warning for constant expressions


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47659

--- Comment #4 from Thomas Henlich <thenlich at users dot sourceforge.net> 2011-08-08 06:07:33 UTC ---
It is not safe to omit the warning for integers: the constant could have been
truncated to an integer, as in:

    real(8) :: r8
    r8 = 12345678.9
    print *, r8

=> 12345679.0000000

So the best we can do is probably the unconditional warning. Maybe the warning
in this case should only be emitted when -Wconversion-extra is in effect.
That's how it works for variables (conversion to a higher precision), it should
be the same for constants (for consistency).

Similarly, for -Wconversion-extra the conversion to a lower precision should
always give a warning, even if no digits are lost.


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