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 

2 compiler errors with PURE procedures

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



Joined: 02 Feb 2007
Posts: 6

PostPosted: Mon Feb 05, 2007 3:37 pm    Post subject: 2 compiler errors with PURE procedures Reply with quote

I am trying out FTN95 5.01 and found 2 bugs in the implementation of pure procedures. I attach a simple file that triggers them during compilation. The code, the errors reported by the compiler, and my comments are listed below. The same errors are triggered whether the procedures are functions or subroutines.

It appears that FTN95 automatically gives all local entities (including intermediate results, as in 'abs(a)') the SAVE attribute, which seems strange. Any comments from the developers?

!==================
module pureTestMod
! Error 1: line 10 ('integer::n1'): error 829 - N1 cannot have the SAVE
! attribute inside a PURE subprogram
! dk: 'n1' DOES NOT have the 'save' attribute. this error is only triggered
! when an internal routine is present (even if its not actually used).
! Error 2: line 12 ('selectcase (abs(a))') : error 1063 - You cannot set the
! value of the non-local variable Temp@1 inside the PURE routine
! PURETEST
! dk: 'abs(a)' should not be stored nonlocally.
contains
pure subroutine puretest(a)
implicit none
integer,intent(inout)::a
integer::n1
n1=a
select case(abs(a))
case(0:9)
n1=1
end select
a=n1 !*intProc()
contains
pure function intProc()
implicit none
integer::intProc
intProc=4
endfunction intProc
endsubroutine puretest
end module puretestmod
!----
program FTN95test
use puretestMod
implicit none
integer::a
call puretest(a)
end program FTN95test
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Feb 07, 2007 10:41 am    Post subject: Reply with quote

I will log this as something to investigate.
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