Skip to content

[Flang] WRITE with E20.0 of value 1.0 does not raise error condition as it should. #78390

Closed
@harishch4

Description

@harishch4

The value written with E20.0 is "0.E+01" and IOSTAT is not set to non-zero.
However, with classic-flang and gfortran, IOSTAT is assigned a non-zero value. Sample.

Sample.f90

Program test_WRITE_IOSTAT
  Integer, Parameter:: quad = selected_real_kind(22)
  Integer :: i
  Write(*,'(E20.0)',iostat=i) 1.0_quad
  If (i==0) Then
     Print '("bug quad")'
  Else
     Print '("ok quad")'
  End if
  Write(*,'(E20.0)',iostat=i) 1.0d0
  If (i==0) Then
     Print '("bug double")'
  Else
     Print '("ok double")'
  End if
  Write(*,'(E20.0)',iostat=i) 1.0
  If (i==0) Then
     Print '("bug real")'
  Else
     Print '("ok real")'
  End if
End Program test_WRITE_IOSTAT

llvm-flang output:

      0.10000000E+01
bug quad
      0.10000000E+01
bug double
      0.10000000E+01
bug real

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorflang:runtime

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions