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 ('integern1'): 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 integern1 n1=a select case(abs(a)) case(0:9) n1=1 end select a=n1 !*intProc() contains pure function intProc() implicit none integerintProc intProc=4 endfunction intProc endsubroutine puretest end module puretestmod !---- program FTN95test use puretestMod implicit none integer::a call puretest(a) end program FTN95test