- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15k
Closed
Bug
Copy link
Labels
Description
Consider the following code:
module m
   type :: base
      integer(4)   ::  i = -999
      character(3) ::  c = 'xxx'
   end type
   interface read(formatted)
      subroutine readformatted(dtv, unit, iotype, v_list, iostat, iomsg )
         import base
         class(base), intent(inout) :: dtv
         integer,  intent(in) :: unit
         character(*), intent(in) :: iotype
         integer, intent(in)     :: v_list(:)
         integer,  intent(out) :: iostat
         character(*),  intent(inout) :: iomsg
      end subroutine
   end interface
end module
program array104
   use m
   type(base) :: b1(4)
   integer :: stat
   character(200) :: msg = ''
   namelist /nml1/ b1
   open (1, file = 'array104.1', form='formatted', access='sequential' )
   read (1,NML=nml1, iostat=stat, iomsg=msg)
print*, stat
print*, msg
   if ( stat /=  0 ) ERROR STOP 1
end program
subroutine readformatted (dtv, unit, iotype, v_list, iostat, iomsg)
   use m, only: base
   class(base), intent(inout) :: dtv
   integer, intent(in) :: unit
   character(*), intent(in) :: iotype
   integer, intent(in)     :: v_list(:)
   integer, intent(out) :: iostat
   character(*), intent(inout) :: iomsg
   read ( unit, "(A3,1X)", iostat = iostat, iomsg=iomsg ) dtv%c
   read ( unit, "(I4,1X)", iostat = iostat, iomsg=iomsg ) dtv%i
end subroutine
The input file array104.1
 &nml1
 b1(4)=JKL 1004
 b1(3:1:-2)=GHI 1003 ABC 1001
 b1(2)=DEF 1002
 /
Flang complains
> a.out
 1001
 Bad character ':' in INTEGER input field
Fortran ERROR STOP: code 1