- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The same three lines used as input from a file that work do not work when read from an internal
file. So If the input looks like
&args
A=T
\
that works from a file, but fails from an internal file. If the lines are very long (example uses 4096 characters to cause failure) it fails from the file as well. If add a comma after the "T" it works from internal file.
program main
logical :: a;namelist /args/ a
character(len=256) :: iomsg
integer :: iostat, i
character(len=4096) :: input(3)
input(1)='&args'
input(2)=' A=T'
input(3)=' /'
open(unit=10,status='scratch')
write(10,'(a)')(trim(input(i)),i=1,3)
!write(10,'(a)')(input(i),i=1,3) ! this fails too when lines are long
rewind(10)
read(10,nml=args,iostat=iostat,iomsg=iomsg)
if(iostat.ne.0) write(*,*)'from file iostat=',iostat,trim(iomsg)
read(input,nml=args,iostat=iostat,iomsg=iomsg)
if(iostat.ne.0) write(*,*)'from internal file iostat=',iostat,trim(iomsg)
end program main
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for reporting this. I filed a bug report, CMPLRLLVM-47810. I'll let you know when I know more about a fix.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The fail on the write statement may be because there is a default record length when you open the unit. Possibly try adding RECL greater than your string size.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This problem with NAMELIST is fixed in an early version of the 2024.2 compilers. They are planned for release in mid-2024.
Watch for the announcement!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page