|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Fri Jul 10, 2020 5:16 pm Post subject: Another long-lived bug |
|
|
When program source is taken from old reports using OCR, '5' may be scanned as 'S', 'X' as 'K', etc. Usually, these errors are caught at compile time. Here, however, is one example where FTN95 (Versions 5.5; 8.63) takes '1S' as if it were '1', '2S' as if it were just '2', and happily compiles and links the program!
Code: | program bug1S
implicit none
real a(15),b(1S) ! BUGs here: OCR gave 1S in place of 15
integer i
do i=1,15
a(i)=2.5*i+0.5
b(i)=3.3*i-0.3
end do
print *,(i,a(i),b(i),i=1,15)
end program |
I have a suspicion that the suffix 'S' is being taken to signify that the constant is a 16-bit integer (a carryover from the DOS and FTN77 days?) |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Sat Jul 11, 2020 8:17 am Post subject: |
|
|
mecej4
Yes, 1S represents one as a 16 bit integer whilst 1L represents one as a 32 bit integer which is even more problematical when 11 is written as 1l (lower case L).
The aim is that FTN95 should compile anything that works with FTN77. Presumably S and L were allowed in some old dialects.
At the moment you need /ISO to see this error but I will add a warning so that you will be able to configure FTN95 to upgrade the new warning to an error. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Sat Jul 11, 2020 9:13 am Post subject: |
|
|
mecej4
It looks like it was the intention that you should get a warning but there was a double negative in FTN95 that was not coded correctly. This has now been fixed for the next release of FTN95.
In future you will need to use /NON_STANDARD in order to suppress the warning. |
|
Back to top |
|
|
Robert
Joined: 29 Nov 2006 Posts: 445 Location: Manchester
|
Posted: Sat Jul 11, 2020 11:21 am Post subject: |
|
|
Maybe have a specific warning for it and let them turn it off explicitly. /NON_STANDARD sounds a bit sweeping. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Sat Jul 11, 2020 3:12 pm Post subject: |
|
|
OPTIONS INTS or INTL may be giving the game away somewhat. Lots of the Clearwin+ examples in FTN95.CHM have a 1L in them.
Whether or not S and 5 look alike, or O and 0, depends on the font you use in your editor or how they are printed*, but I've never heard of X and K being confused, not until now. As to whether 1 and capital I are confused, again it depends on the font, but as Paul points out, 1 and l sometimes look a lot like each other.
Roll on the days when Fortran 2055 allows programming in Katakana in vertical columns which have no line length limitation, and we can see the green rain of The Matrix cascading down our screens as the program executes.
Eddie
*Or how you write the characters on your coding sheets! |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Jul 14, 2020 9:30 am Post subject: |
|
|
Further to my last post, by default /NON_STANDARD is configured to be on.
This means that there is no need to change FTN95 in this respect. The error that I discovered turns out to be benign.
You can use /-NON_STANDARD to enable related warning messages or /ISO to enable corresponding error reports.
Hopefully using /-NON_STANDARD will not produce too many unwelcome warnings. |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Tue Jul 14, 2020 2:19 pm Post subject: |
|
|
Thanks, Paul. In FTN95.chm, under /NON_STANDARD it has "/IOS" instead of "/ISO". |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Jul 14, 2020 3:14 pm Post subject: |
|
|
Thank you. I have corrected that. |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Wed Jul 15, 2020 1:00 am Post subject: Re: |
|
|
LitusSaxonicum wrote: | Whether or not S and 5 look alike, or O and 0, depends on the font you use in your editor or how they are printed, but I've never heard of X and K being confused, not until now. As to whether 1 and capital I are confused, again it depends on the font. |
Eddie, there is at least one additional factor beside fonts, when it comes to PDFs obtained by scanning old printed matter: alignment. To see this, open (if your browser does not display PDFs, you may need to first download the file -- it is about 9 MB long) this US Govt. report: https://pdfs.semanticscholar.org/e177/64aebd0b3be95372d0875d102677c05550a3.pdf
Go to the bottom of the page with printed number 137 (p. 142 by Acrobat Reader's count). Select the last two lines of code with the mouse; notice that the selection rectangle is not quite aligned with the text. Copy and paste into a text editor. What I see is
Code: | CALL FETCH (KRIV,ITO,DATA,RMIDX,SPINOI,TOINDX,NDATA.LRMlUAS
2 NVK,NTMOD,RMSFIL) |
instead of the correct version,
Code: | CALL FETCH (KR,IV,IT0,DATA,RMIDX,SPINDX,T0INDX,NDATA,LRMIDX,
2 NVK,NTMOD,RMSFIL) |
|
|
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
|