The code below compiles with g95 and Intel Fortran but not with PVF 7.0.7. I’ve noticed that exchanging the order of the following declaration lines inside realToChar function:
real(rp), intent(in) :: num
character(getRealLength(num)) :: char
resolves the first error (type mismatch), but the second remains. A (not so) minimal test case follows:
module printUtils
implicit none
private
integer, parameter :: rp = selected_real_kind(p=15);
interface strLen
module procedure getRealLength
end interface strLen
interface toChar
module procedure realToChar
end interface toChar
contains
pure function getRealLength(num) result(len)
integer :: len
real(rp), intent(in) :: num
character(50) :: tmp
write(tmp, *) num
len = len_trim(tmp)
end function getRealLength
pure function realToChar(num) result(char)
character(getRealLength(num)) :: char
real(rp), intent(in) :: num
write(char, *) num
end function realToChar
pure function len_nopath(fname) result(len)
character(*), intent(in) :: fname
integer :: len, fin
fin = len_trim(fname)
len = fin - index(trim(fname), '/', back=.true.)
if (len == fin) len = fin - index(trim(fname), '\', back=.true.)
if (len == fin) len = fin
end function len_nopath
end module printUtils