soccer jersey forums.silverfrost.com :: View topic - Wrong type argument to intrinsic routine goes undetected
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 

Wrong type argument to intrinsic routine goes undetected

 
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: 1897

PostPosted: Wed Mar 10, 2021 1:18 am    Post subject: Wrong type argument to intrinsic routine goes undetected Reply with quote

The following code mistakenly passes a 2-byte integer as the first argument to the intrinsic subroutine GET_COMMAND_ARGUMENT. The 8.70 compiler does not detect this error, even if /CHECK or /CHECKMATE is specified.

Code:
program test_args
implicit none
character carg*20
integer icount
integer*2 i2           !wrong integer size for arg to GET_COMMAND_ARGUMENT
!
iCount = 1 + COMMAND_ARGUMENT_COUNT()
if(iCount.gt.1) then
   i2 = 1
   call GET_COMMAND_ARGUMENT(i2, carg)
   print *,trim(carg)
endif
end program


When this code is compiled for 32-bit and run with one argument,

Code:
s:\lang>test_args xyz


the response is

Code:
 ��������������������


With /64, the response is a pop up with the message "integer overflow at address ...".
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Mar 10, 2021 8:53 am    Post subject: Reply with quote

mecej4

Thank you for the bug report. I have made a note that this needs to be fixed.
Back to top
View user's profile Send private message AIM Address
mecej4



Joined: 31 Oct 2006
Posts: 1897

PostPosted: Wed Mar 10, 2021 9:59 am    Post subject: Reply with quote

The reason for the wrong argument type is that many codes developed in the 1990s used the Microsoft extensions NARGS, GET_ARG, GET_DATE and GET_TIME. At that time, standard Fortran did not provide the functionality of these routines. The 2-byte integers used as arguments for these extensions were appropriate for the 16-bit compilers of the day.

Unless one is on the lookout for INTEGER*2 declarations, which I was not, one can get into trouble, as I did.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Mar 10, 2021 12:07 pm    Post subject: Reply with quote

This failure has now been fixed for the next release of FTN95.
Back to top
View user's profile Send private message AIM Address
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