Skip to content

[flang] DECIMAL edit specifiers do not handle the value separator correctly in list-directed I/O. #141515

Closed
@DanielCChen

Description

@DanielCChen

Consider the following code:

      implicit none

      real :: rlarr(5) = (/1.11,22.2,333.33,44.4,0.0/)
      character(170) :: buffer_comma(3)
      character(170) :: buffer_point(3)

      namelist /nml_r/ rlarr

      write(buffer_comma,nml_r,decimal='comma')
      write(6,*) buffer_comma

      write(buffer_point,nml_r,decimal='point')
      write(6,*) buffer_point
      end

Flang prints

  &NML_R RLARR= 1,11 22,2 333,33 44,4 0,/

  &NML_R RLARR= 1.11 22.2 333.33 44.4 0./

While the test case is expecting

  &NML_R RLARR= 1,11; 22,2; 333,33; 44,4; 0,/

  &NML_R RLARR= 1.11, 22.2, 333.33, 44.4, 0./

The standard says [24-007: 13.6]

If the decimal edit mode is COMMA during list-directed input/output, the character used as a value separator is a semicolon in place of a comma.

It seems the value separator is missing from both decimal edit modes.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions