Gfortran 6.0.0 and flag -Wconversion-extra ?

Jorge D'Elia jdelia@intec.unl.edu.ar
Sun Aug 2 14:14:00 GMT 2015


Hi,

An issue about the -Wconversion-extra flag. The manual states that 
-Wconversion-extra warns of implicit conversions between different 
types and kinds. However in the next test I try to do an explicit 
conversion of kind and even the warning persists:

$ gfortran --version
  GNU Fortran (GCC) 6.0.0 20150801 (experimental)
  Copyright (C) 2015 Free Software Foundation, Inc.

$ cat test.f90
  program test
    use ISO_FORTRAN_ENV
    implicit none
    integer, parameter :: isp = REAL_KINDS(1)
    integer, parameter :: idp = REAL_KINDS(2)
    real(idp), parameter :: tol =      epsilon(1.0_idp)
    real(idp), parameter :: eps = real(epsilon(1.0_isp),kind=idp)
    write (*,*)" tol = ", tol
    write (*,*)" eps = ", eps
  end program test

$ gfortran -std=f2008 -Wall -Wextra -Wpedantic -Wsurprising -o test.exe test.f90

$ ./test.exe
  tol =    2.2204460492503131E-016
  eps =    1.1920928955078125E-007

$ gfortran -std=f2008 -Wall -Wextra -Wpedantic -Wsurprising -Wconversion-extra -o test.exe test.f90

    test.f90:9:37:
 
    real(idp), parameter :: eps = real(epsilon(1.0_isp),kind=idp)
                                     1
    Warning: Conversion from 'REAL(4)' to 'REAL(8)' at (1) [-Wconversion-extra]

Perhaps, the explicit cast is not valid in the definition of a parameter?

Regards,
Jorge.
CIMEC (UNL-CONICET), http://www.cimec.org.ar/
--



More information about the Fortran mailing list