public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42809]  New: Too much noise with -Wconversion
@ 2010-01-19 22:39 anlauf at gmx dot de
  2010-01-19 22:42 ` [Bug fortran/42809] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: anlauf at gmx dot de @ 2010-01-19 22:39 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-05-10 19:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-19 22:39 [Bug fortran/42809] New: Too much noise with -Wconversion anlauf at gmx dot de
2010-01-19 22:42 ` [Bug fortran/42809] " pinskia at gcc dot gnu dot org
2010-01-19 22:59 ` anlauf at gmx dot de
2010-01-20 23:02 ` anlauf at gmx dot de
2010-01-21 21:12 ` anlauf at gmx dot de
2010-01-22 20:43 ` anlauf at gmx dot de
2010-05-08 17:29 ` dfranke at gcc dot gnu dot org
2010-05-10 17:12 ` dfranke at gcc dot gnu dot org
2010-05-10 19:26 ` dfranke at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).