This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/42809] New: Too much noise with -Wconversion
- From: "anlauf at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jan 2010 22:38:52 -0000
- Subject: [Bug fortran/42809] New: Too much noise with -Wconversion
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
There is a lot of noise generated with -Wconversion:
program gfcbug100
implicit none
integer, parameter :: sp = kind (1.0)
integer, parameter :: dp = kind (1.d0)
real(sp) :: s
real(dp) :: d
complex(dp) :: z
s = 0 ! Warn if you are very picky
d = s ! No reason for a warning
z = (0, 1) ! Many warnings for this one!
end program gfcbug100
Which gives:
gfcbug100.f90:11.8:
z = (0, 1) ! Many warnings for this one!
1
Warning: Conversion from INTEGER(4) to REAL(4) at (1)
gfcbug100.f90:11.11:
z = (0, 1) ! Many warnings for this one!
1
Warning: Conversion from INTEGER(4) to REAL(4) at (1)
gfcbug100.f90:9.6:
s = 0 ! Warn if you are very picky
1
Warning: Conversion from INTEGER(4) to REAL(4) at (1)
gfcbug100.f90:10.6:
d = s ! No reason for a warning
1
Warning: Conversion from REAL(4) to REAL(8) at (1)
gfcbug100.f90:11.6:
z = (0, 1) ! Many warnings for this one!
1
Warning: Conversion from COMPLEX(4) to COMPLEX(8) at (1)
It would be nice if the promotion kind=4 to kind=8 would never
produce a warning in cases like the above as it is always exact.
Also, promoting integers to reals is often possible without any
loss of accuracy, this is certainly the case for 0 and 1 ;-)
The complex literal is particularly funny, generating 3 warnings.
This is at least one too much. (0,1) gets promoted by default
to (0.0,1.0) as required by the standard, and the complex conversion
is exact.
Any attempt at reducing the above noise is greatly appreciated.
--
Summary: Too much noise with -Wconversion
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: anlauf at gmx dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42809