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

[flang] Incorrect execution result of writing and reading namelist-group-name as described in the NAMELIST statement #62598

Closed
ohno-fj opened this issue May 8, 2023 · 2 comments
Assignees

Comments

@ohno-fj
Copy link

ohno-fj commented May 8, 2023

Version of flang-new : 17.0.0(5a50ba03e9adb1614189530f8a5ef06d90dfd670)

The execution result of writing and reading namelist-group-name as described in the NAMELIST statement is incorrect.
The Write statement on line 26 in subroutine yy does not seem to work correctly.

The following are the test program, results of Flang-new, GFortran and ifort compilation and execution.

snggf688_5.f90:

program main
  call s1
  print *,'pass'
end program main

module m1
  namelist /a/ i
end module m1

subroutine s1
  namelist /a/i
  call xx
  call yy
  write(6,*) "before read : i = ", i
  rewind 1
  read(1,a)
  write(6,*) "after  read : i = ", i
  if (i/=2)write(6,*) "NG i = ", i
contains
  subroutine xx
    use m1
    i=2
  end subroutine xx
  subroutine yy
    use m1
    write(1,a)
    i=3
  end subroutine yy
end subroutine s1
$ flang-new -flang-experimental-exec snggf688_3.f90; ./a.out
 before read : i =  3
 after  read : i =  0
 NG i =  0
 pass
$
$ cat fort.1
&A I= 0/
$
$ gfortran snggf688_3.f90; ./a.out
 before read : i =            0
 after  read : i =            2
 pass
$
$ cat fort.1
&A
 I=2          ,
 /
$
$ ifort snggf688_3.f90; ./a.out
 before read : i =            0
 after  read : i =            2
 pass
$
$ cat fort.1
 &A
 I       =           2
 /
$
@EugeneZelenko EugeneZelenko added flang Flang issues not falling into any other category and removed new issue labels May 8, 2023
@klausler klausler self-assigned this May 10, 2023
@klausler
Copy link
Contributor

@EugeneZelenko EugeneZelenko added flang:frontend and removed flang Flang issues not falling into any other category labels May 10, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented May 10, 2023

@llvm/issue-subscribers-flang-frontend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants