https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67541

            Bug ID: 67541
           Summary: -Wconversion-extra no warning on double = double +
                    single
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jamiebayne at hotmail dot com
  Target Milestone: ---

It is my belief (or at least desire) that every assignment in the following
program should emit a warning  with the -Wconversion{,-extra} flags (GCC
5.2.1):

    PROGRAM conversion_test
        INTEGER, PARAMETER :: sp = KIND(1.0)
        INTEGER, PARAMETER :: dp = KIND(1.d0)
        REAL(sp) :: single
        REAL(dp) :: double  
        double = 4.0_sp    ! -Wconversion-extra: Warning: Conversion from 
                           !     REAL(4) to REAL(8) at (1)
        double = single    ! -Wconversion-extra: Warning: Conversion from 
                           !     REAL(4) to REAL(8) at (1)
        single = double    ! -Wconversion: Warning: Possible change of 
                           !     value in conversion from REAL(8) to 
                           !     REAL(4) at (1)
                           ! -Wconversion-extra: Warning: Conversion from 
                           !     REAL(8) to REAL(4)
        single = double + single  ! -Wconversion: Warning: Possible change
                                  !     of value in conversion from REAL(8)
                                  !     to REAL(4) at (1)
                                  ! -Wconversion-extra: Conversion from
                                  !     REAL(8) to REAL(4) at (1)

        ! no warnings
        single = 7.0_dp 
        double = double + single
    END PROGRAM conversion_test

Is this intended behaviour, or am I right in thinking that particularly the
double = double + single line should give a warning?

(For my purposes, I'm specifically interested in any expression which results
in a cvtss2sd on x86-64.)

Reply via email to