I am still hoping to be able to use UDDTIO in our Fortran programs before retirement, but time is running short. While the v17 compiler corrects a few of the many bugs I signalled, it manages to introduce new, fascinating ones like this:
module m_test
type t1
integer :: a
contains
procedure, private :: r_t1
generic :: read(formatted) => r_t1
end type
contains
subroutine r_t1(dtv, unit, iotype, vlist, iostat, iomsg)
class(t1), intent(inout) :: dtv
integer, intent(in) :: unit
character(len=*), intent(in) :: iotype
integer, intent(in) :: vlist(:)
integer, intent(out) :: iostat
character(len=*), intent(inout) :: iomsg
read(unit, fmt="(i4)", iostat=iostat, iomsg=iomsg) dtv%a
end subroutine
end module
program test
use m_test
character(len=:), allocatable :: str
type(t1) :: x,y,z
str="111122223333444455555"
read(str, fmt="(DT,DT,DT)") x,y,z
print *, x%a, y%a, z%a
read(str, fmt="(3DT)") x,y,z
print *, x%a, y%a, z%a
end program
when compiled and run gives this.
C:\dev\f95\bugs\intel>ifort test.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.4.210 Build 20170411
Copyright (C) 1985-2017 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
-subsystem:console
test.obj
C:\dev\f95\bugs\intel>test
1111 2222 3333
forrtl: severe (125): A derived type variable in this statement requires a DT format specifier because it has a component that is ALLOCATABLE, POINTER, or PRIVATE, unit -5, file Internal Formatted Rea
d
Image PC Routine Line Source
test.exe 00007FF7CDF4E9CD Unknown Unknown Unknown
test.exe 00007FF7CDF39226 Unknown Unknown Unknown
test.exe 00007FF7CDF31569 Unknown Unknown Unknown
test.exe 00007FF7CDFA024E Unknown Unknown Unknown
test.exe 00007FF7CDFA05E5 Unknown Unknown Unknown
KERNEL32.DLL 00007FFA1AA216AD Unknown Unknown Unknown
ntdll.dll 00007FFA1B8154E4 Unknown Unknown Unknown
C:\dev\f95\bugs\intel>
If I simply change the order of the two read statements:
...
program test
use m_test
character(len=:), allocatable :: str
type(t1) :: x,y,z
str="111122223333444455555"
read(str, fmt="(3DT)") x,y,z
print *, x%a, y%a, z%a
read(str, fmt="(DT,DT,DT)") x,y,z
print *, x%a, y%a, z%a
end program
it seems to run ok:
C:\dev\f95\bugs\intel>ifort test.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.4.210 Build 20170411
Copyright (C) 1985-2017 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
-subsystem:console
test.obj
C:\dev\f95\bugs\intel>test
1111 2222 3333
1111 2222 3333
C:\dev\f95\bugs\intel>
the compiler v16 update 4 does not expose this problem.