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 

FTN95 bug: array valued functions in expressions

 
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: Thu Jun 04, 2015 2:45 pm    Post subject: FTN95 bug: array valued functions in expressions Reply with quote

FTN95 7.1 has problems processing expressions that contain array constructors and functions that return arrays. Some of these problems surfaced in a recent thread ( http://forums.silverfrost.com/viewtopic.php?t=3095 ), and here is a simple reproducer.
Code:
program getdiag
implicit none
real matrix(2,2),d4(4)
!
matrix=reshape((/ 2.,4.,5.,3. /),(/2,2/))
d4 = (/ 1.0, diagf(matrix), 4.0 /) ! FTN95 bug here
print*,d4

contains
   function diagf(A)
      real :: A(2,2),diagf(2)
      diagf = (/ A(1,1), A(2,2) /)
      return
   end function
end program

The compiler says
Code:
0006) d4 = (/ 1.0, diagf(matrix), 4.0 /) ! FTN95 bug here
*** Non-conformant array shapes in first rank of an array expression (4 and 3)

which suggests that it does not recognize that diagf() is of size 2, not 1.

If the array constructor is used in an I/O list, compilation goes through, but the resulting program attempts to read from address zero.
Code:
program getdiag
implicit none
real matrix(2,2)
!
matrix=reshape((/ 2.,4.,5.,3. /),(/2,2/))
print *, (/ 1.0, diagf(matrix), 4.0 /) ! FTN95 bug here

contains
   function diagf(A)
      real :: A(2,2),diagf(2)
      diagf = (/ A(1,1), A(2,2) /)
      return
   end function
end program

[P.S. 6/15/2015]Same bugs also present in FTN95-7.20.


Last edited by mecej4 on Mon Jun 15, 2015 10:58 pm; edited 2 times in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Jun 05, 2015 9:22 am    Post subject: Reply with quote

Thanks for the information. I have logged this for investigation.
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: Mon Jul 06, 2020 10:33 am    Post subject: Reply with quote

This bug has now been fixed for the next release of FTN95.
Back to top
View user's profile Send private message AIM Address
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Mon Jul 06, 2020 5:58 pm    Post subject: Reply with quote

now that's what i call (organized) dedication. Your Bob the Builder list must be very long Paul if you're still churning out fixes from 2015 ! Well done !
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
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