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 

Runtime errors produced for error-free code

 
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: Sat Apr 23, 2022 1:09 am    Post subject: Runtime errors produced for error-free code Reply with quote

The following test program is error-free.

Code:
program packbug
implicit none
integer :: pci(20)
integer, allocatable :: prm(:)
pci = [3,5,7,0,11,13,0,17,19,0,23,0,0,29,31,0,0,37,0,41]
prm = pack(pci, pci > 0)
print '(A,2x,I2)','Count of nonzero entries = ',size(prm)
print '(12i3)',prm
end program


The expected output is

Code:
Count of nonzero entries =   12
  3  5  7 11 13 17 19 23 29 31 37 41


When the code is compiled with ftn95 8.84 with just /debug, linked and run, the program aborts with "*** Error 416: Bad request for stack memory"

When compiled with /64 /debug, linked and run, the program aborts with an access violatation on line-6.

When compiled with /check, linked and run, the program aborts with "Error: Reference through NULL Fortran POINTER".

When the options /check /64 are used, the program runs to completion, but gives the incorrect output:

Code:
Count of nonzero entries =    0


The bugs go away if the declaration of the array variable prm is changed to

Code:
integer :: prm(12)
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Apr 23, 2022 8:23 am    Post subject: Reply with quote

mecej4

Thank you for the bug report which I have logged for investigation.

This relates to the recent addition to FTN95 of "allocate on assignment" from the Fortran 200x standard.
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 30, 2022 2:24 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