Skip to content

[flang] I/O Runtime failure with BLANK=zero in READ #150035

@DanielCChen

Description

@DanielCChen

Consider the following code:

      implicit none

      integer, parameter :: in = 11

      real(4)    :: rl4
      real(8)    :: rl8
      complex(4) :: cx4
      complex(8) :: cx8

      open(in, file='modeBlankNaNInfIO002.dat', blank='zero')

      ! read the values in using BLANK mode of ZERO
      read(in, *, blank='zero')  rl4, rl8, cx4, cx8

      ! read the values in using BLANK mode of NULL
      read(in, *, blank='null')  rl4, rl8, cx4, cx8

      ! read the values in using BLANK mode of ZERO
      read(in, *, blank='zero')  rl4, rl8, cx4, cx8

      close(in)

      end

The modeBlankNaNInfIO002.dat is:

 -NaN(Q)   -NaN(S)   (  +Inf  ,+3.14  ) (Infinity   ,  NaN(_abcd123)   )
 -NaN(Q)   -NaN(S)   (  +Inf  ,+3.14  ) (Infinity   ,  NaN(_abcd123)   )
  +NaN(S)   +NaN(Q)   (  -3.14  ,  -NaN()  ) (  -Infinity , nan )
  +NaN(S)   +NaN(Q)   (  -3.14  ,  -NaN()  ) (  -Infinity , nan )

Flang failed at execution as:

> a.out

fatal Fortran runtime error(t.f:19): Bad real input data at column 44 of record 3
IOT/Abort trap(coredump)

Both gfortran and XLF executes the code successfully.

If I remove all of the blank= specifier from the open and read statements, it works fine.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions