This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47659] -Wconversion[-extra] should emit warning for constant expressions
- From: "thenlich at users dot sourceforge.net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 8 Aug 2011 06:08:25 +0000
- Subject: [Bug fortran/47659] -Wconversion[-extra] should emit warning for constant expressions
- Auto-submitted: auto-generated
- References: <bug-47659-4@http.gcc.gnu.org/bugzilla/>
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.