https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67219
Bug ID: 67219 Summary: [6 Regression] Incorrect conversion warning Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: Joost.VandeVondele at mat dot ethz.ch Target Milestone: --- The following testcase leads to an incorrect conversion warning (and a failed CP2K build) with gcc 6.0, while 5.1 compiles fine > cat bug.f90 MODULE kinds IMPLICIT NONE INTEGER, PARAMETER :: int_4 = SELECTED_INT_KIND(5) INTEGER, PARAMETER :: int_8 = SELECTED_INT_KIND(10) INTEGER, PARAMETER :: valt = int_8 END MODULE MODULE foo USE kinds IMPLICIT NONE CONTAINS ELEMENTAL FUNCTION kg_get_value(dsat, degree) RESULT(value) INTEGER, INTENT(IN) :: dsat, degree INTEGER(KIND=valt) :: value INTEGER, PARAMETER :: huge_4 = HUGE(0_int_4) value = (huge_4 - INT(dsat,KIND=int_8)) * huge_4 + huge_4-degree END FUNCTION END MODULE > gfortran -c -Wconversion -Werror bug.f90 bug.f90:14:56: INTEGER, PARAMETER :: huge_4 = HUGE(0_int_4) 1 Error: Change of value in conversion from ‘INTEGER(4)’ to ‘REAL(4)’ at (1) [-Werror=conversion] f951: all warnings being treated as errors There are no REAL(4) in this statement, AFAICT.