[Bug fortran/47659] -Wconversion[-extra] should emit warning for constant expressions
thenlich at users dot sourceforge.net
gcc-bugzilla@gcc.gnu.org
Mon Aug 8 06:08:00 GMT 2011
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.
More information about the Gcc-bugs
mailing list