Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29274 Discussions

Repeat count with DT edit descriptor crashes

johnyb_
New Contributor I
772 Views

When using a repeat count for the DT edit descriptor, a read statement crashes:

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
    integer  :: i,j,k
    str="111122223333444455555"
    read(str, fmt="(3i4)") i,j,k
    print *, i,j,k
    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
C:\TEMP>ifort test.f90 /standard-semantics
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.4.221 Build 20150407
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 11.00.61030.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:test.exe
-subsystem:console
test.obj

C:\TEMP>test
 1111 2222 3333
 1111 2222 3333
forrtl: severe (24): end-of-file during read, unit -5, file Internal Formatted Read
Image              PC                Routine            Line        Source
test.exe           00007FF7A26AACC9  Unknown               Unknown  Unknown
test.exe           00007FF7A26974C3  Unknown               Unknown  Unknown
test.exe           00007FF7A26916BC  Unknown               Unknown  Unknown
test.exe           00007FF7A270021E  Unknown               Unknown  Unknown
test.exe           00007FF7A26E9494  Unknown               Unknown  Unknown
KERNEL32.DLL       00007FF9814816AD  Unknown               Unknown  Unknown
ntdll.dll          00007FF982BC34A5  Unknown               Unknown  Unknown

C:\TEMP>

I cannot see an exception in the standard (Fortran 2008) forbidding the use of a repeat count with the DT edit descriptor. I tried some variants like 3(DT), 3(DT(1)), 3DT'x', they all fail.

 

0 Kudos
3 Replies
Steven_L_Intel1
Employee
772 Views

I can see the failure in 15.0.4 but not in 16.0.0, which is available now.

0 Kudos
johnyb_
New Contributor I
772 Views

Thanks,

I asked IT to download the new version and will install it then.

0 Kudos
johnyb_
New Contributor I
772 Views

We have just installed v16 of the compiler and the problem does not occur anymore

thanks

0 Kudos
Reply