Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In NAMELIST output editing, leading blank is missing. #76798

Closed
harishch4 opened this issue Jan 3, 2024 · 3 comments · Fixed by #76846
Closed

In NAMELIST output editing, leading blank is missing. #76798

harishch4 opened this issue Jan 3, 2024 · 3 comments · Fixed by #76846
Assignees

Comments

@harishch4
Copy link
Contributor

The first character written in a NAMELIST i/o record must be a blank. The words in the Standard are "Except for continuation of delimited character sequences, each output record begins with a blank character to provide carriage control when the record is printed" (F95) and "Except for new records created by explicit formatting within a defined output procedure or by continuation of delimited character sequences, each output record begins with a blank character." (F2023).

The gfortran & llvm-flang compilers do not put a blank. The Intel compiler does put a blank for external units but misses the blank for internal units.

Program test_namelist_blank
  Integer :: i,j
  Character(300) ::s
  Namelist /nml1/i,j

  i = 99
  j = 42
  Write (s,NML=nml1)
  Write (*,'("Internal ",A)') Merge('ok ','bug',s(1:1)==' ')
  Write (*,NML=nml1)
End Program test_namelist_blank
@harishch4 harishch4 added the flang Flang issues not falling into any other category label Jan 3, 2024
@klausler klausler self-assigned this Jan 3, 2024
klausler added a commit to klausler/llvm-project that referenced this issue Jan 3, 2024
As NAMELIST output is a variant of list-directed output, its editing
must produce leading spaces on (most) output records to effect carriage
control.  These spaces are required by the language standard and
implemented by nearly all other Fortran compilers (except GNU).

Fixes llvm#76798.
@klausler
Copy link
Contributor

klausler commented Jan 3, 2024

#76846

klausler added a commit that referenced this issue Jan 15, 2024
As NAMELIST output is a variant of list-directed output, its editing
must produce leading spaces on (most) output records to effect carriage
control. These spaces are required by the language standard and
implemented by nearly all other Fortran compilers (except GNU).

Fixes #76798.
@klausler
Copy link
Contributor

Fix has been merged into llvm-project/main.

@EugeneZelenko EugeneZelenko added flang:runtime and removed flang Flang issues not falling into any other category labels Jan 16, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 16, 2024

@llvm/issue-subscribers-flang-runtime

Author: None (harishch4)

The first character written in a NAMELIST i/o record must be a blank. The words in the Standard are "**Except for continuation of delimited character sequences, each output record begins with a blank character to provide carriage control when the record is printed**" (F95) and **"Except for new records created by explicit formatting within a defined output procedure or by continuation of delimited character sequences, each output record begins with a blank character.**" (F2023).

The gfortran & llvm-flang compilers do not put a blank. The Intel compiler does put a blank for external units but misses the blank for internal units.

Program test_namelist_blank
  Integer :: i,j
  Character(300) ::s
  Namelist /nml1/i,j

  i = 99
  j = 42
  Write (s,NML=nml1)
  Write (*,'("Internal ",A)') Merge('ok ','bug',s(1:1)==' ')
  Write (*,NML=nml1)
End Program test_namelist_blank

justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this issue Jan 28, 2024
As NAMELIST output is a variant of list-directed output, its editing
must produce leading spaces on (most) output records to effect carriage
control. These spaces are required by the language standard and
implemented by nearly all other Fortran compilers (except GNU).

Fixes llvm#76798.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants