forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Another long-lived bug

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Fri Jul 10, 2020 5:16 pm    Post subject: Another long-lived bug Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Jul 11, 2020 8:17 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Jul 11, 2020 9:13 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Robert



Joined: 29 Nov 2006
Posts: 444
Location: Manchester

PostPosted: Sat Jul 11, 2020 11:21 am    Post subject: Reply with quote

Maybe have a specific warning for it and let them turn it off explicitly. /NON_STANDARD sounds a bit sweeping.
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sat Jul 11, 2020 3:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Tue Jul 14, 2020 9:30 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Tue Jul 14, 2020 2:19 pm    Post subject: Reply with quote

Thanks, Paul. In FTN95.chm, under /NON_STANDARD it has "/IOS" instead of "/ISO".
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Tue Jul 14, 2020 3:14 pm    Post subject: Reply with quote

Thank you. I have corrected that.
Back to top
View user's profile Send private message AIM Address
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Wed Jul 15, 2020 1:00 am    Post subject: Re: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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