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: "tkoenig at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 7 Aug 2011 21:20:59 +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 #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-08-07 21:20:36 UTC ---
Created attachment 24945
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24945
Proposed patch
Here's a patch.
For
real a
a = 2.3d0
it checks for truncation correctly and only warns if digits are lost.
Unfortunately, for the case of
double precision a
a = 1.2
I don't see a good way of getting at the original string of numbers to
see if the 1.2 would have been interpreted differently if it had been
a double precision number.
What should we do? Not warn for integers (like I did here) or warn
unconditionally?