Skip to content

[flang] Runtime failure on list-directed I/O #149533

@DanielCChen

Description

@DanielCChen

Consider the following code:

      implicit none

      integer, parameter :: in = 11

      real(4) :: nanq_pos, nanq_neg, nans_pos, nans_neg, inf_pos, inf_neg

      character(3) :: c1, c2

      open(in,  file='modeMixNaNInfIO001.dat', action='read')

      ! reset variables
      nanq_pos = 0.0; nanq_neg = 0.0; nans_pos = 0.0; nans_neg = 0.0
      inf_pos  = 0.0; inf_neg  = 0.0
      c1 = 'xxx'
      c2 = 'xxx'

      open(in, delim='quote', blank='zero', sign='plus')
      read(in, *) nanq_pos, c1, nanq_neg, c2, nans_pos, nans_neg,    &
     &            inf_pos, inf_neg

      close(in)

      end

modeMixNaNInfIO001.dat contains

+nan(q) xlf -nan(q) 'ibm' +nan(s) -nan(s) +inf -Inf
+nan "xlf" -nan() ibm +nan(s) -nan(s) +infinity -Infinity
nan() "xlf" -nan ibm +nan(s) -nan(s) +infinity -Infinity

Flang failed at the execution as

> a.out

fatal Fortran runtime error(t.f:23): invalid character (0x28) after list-directed input value, at column 5 in record 1
IOT/Abort trap(coredump)

It seems it complains about the ( in the record.

If I remove all the "(*)" from the modeMixNaNInfIO001.dat based on Flang's runtime error message, Flang works fine.

Both gfortran and XLF executes the original code successfully.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions