|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
mecej4
Joined: 31 Oct 2006 Posts: 1887
|
Posted: Sat Oct 15, 2016 1:32 pm Post subject: List directed input of logical data with repeat factor fails |
|
|
As the following test program illustrates, list-directed input of data works correctly with integer and real data, but fails with logical data when the input data contains items with the r*v (value v, repeat count r) format.
Code: | program ListRead
implicit none
integer i,ijk(5)
logical :: ljk(5)
real :: rjk(5)
character(len=9) :: iolog = 't 2*f 2*t', ioint = '2 2*3 2*5'
character(len=15) :: ioreal = '2.0 2*3.0 2*5.0'
!
read(ioint,*)ijk
write(*,'(1x,I4,2x,I3)')(i,ijk(i),i=1,5)
read(ioreal,*)rjk
write(*,'(1x,I4,2x,F6.1)')(i,rjk(i),i=1,5)
read(iolog,*)ljk
write(*,'(1x,I4,2x,L1)')(i,ljk(i),i=1,5)
end program |
The runtime error is "Error 52. Invalid character in field. LISTREAD - in file lio.f90 at line 13 [+02d3]"
The same problem occurs when data is read from a file using list-directed input when the input contains, for example, the following record:
t 2*f 2*t
Last edited by mecej4 on Sat Oct 22, 2016 2:11 pm; edited 1 time in total |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Sat Oct 15, 2016 1:45 pm Post subject: |
|
|
Thank you for the feedback. I have logged this for investigation. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Tue Jan 31, 2017 11:30 am Post subject: |
|
|
This has now been fixed for the next release. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Feb 02, 2017 11:10 am Post subject: |
|
|
For some quite obvious reasons, we should expect errors in Fortran 77 features to be less common than those in features introduced later.
As FTN95 was introduced in 'the late 1990s', this must mean that no-one has experienced this problem in two decades - or that it is a regression.
Moreover, if FTN95 was developed over the top of FTN77, but this error was not introduced then, it must have been there even longer!
I wonder if anyone is still using FTN77 and cares to look?
In any case, it shows the extent to which some parts of Fortran are dark and unvisited!
Eddie |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1887
|
Posted: Thu Feb 02, 2017 6:17 pm Post subject: |
|
|
Yes, the bug is (was?) present in FTN77. In Fortran 77, list-directed I/O from/to an internal file was not standard, but FTN77 allows it as an extension. The following version can be compiled using FTN77 4.03 with /ANSI /CHECK, and avoids internal files:
Code: | PROGRAM LSTRD
IMPLICIT NONE
INTEGER I,IJK(5)
LOGICAL LJK(5)
REAL RJK(5)
C
READ(*,*)IJK
WRITE(*,'(1X,I4,2X,I3)')(I,IJK(I),I=1,5)
READ(*,*)RJK
WRITE(*,'(1X,I4,2X,F6.1)')(I,RJK(I),I=1,5)
READ(*,*)LJK
WRITE(*,'(1X,I4,2X,L1)')(I,LJK(I),I=1,5)
END
|
The data for the program:
Code: | 2 2*3 2*5
2.0 2*3.0 2*5.0
T 2*F 2*T
|
NOTE: If anyone wishes to try FTN77, it is still available for download -- there is a link to it from the Silverfrost Web page, see http://silverfrost.com/53/ftn77_personal_edition.aspx . However, the self-extracting Zip file that you download will not run in Windows 10-64. You can extract it using 7Zip, etc., but the setup program will also refuse to run in Windows 10-64. However, I was able to copy the entire FTN77 file set from an old Windows XP backup, as well as the old Winhlp program from XP, and then it ran fine on Windows 10-64. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Feb 02, 2017 7:07 pm Post subject: |
|
|
Hi Mecej4,
I suspected you would know the answer. This must mean that the facility is so useful that nobody used it in 30 or possibly even 40 years!
Or they couldn't make it work, and gave up without protest.
Wow.
Eddie |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|