|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Thu Nov 22, 2018 7:40 pm Post subject: Compiler rejects valid code |
|
|
According to the Fortran 95 standard,
Quote: | 14.1.3 Statement and construct entities
The name of a variable that appears as the DO variable of an implied-DO in a DATA statement or an array constructor has a scope of the implied-DO list. It is a scalar variable that has the type and type parameters that it would have if it were the name of a variable in the scoping unit that includes the DATA statement or array constructor, and this type shall be integer type; it has no other attributes.
|
Therefore, the following code is correct:
Code: | module amod
integer :: ia(2) = (/ (i+2, i=2,3) /)
end module
subroutine suba
use amod
integer :: i
print *,'In suba, i,ia = ',(i,ia(i),' ',i=1,2)
end subroutine
program tst
call suba
end program |
The use of 'I' as the implied DO index on Line-2 does not create a variable 'I' in module AMOD. However, FTN95 8.30 says:
Code: | [FTN95/Win32 Ver. 8.30.279 Copyright (c) Silverfrost Ltd 1993-2018]
PROCESSING MODULE [<AMOD> FTN95/Win32 v8.30.279]
NO ERRORS [<AMOD> FTN95 v8.30.279]
0007) integer :: i
*** I has already been declared in MODULE AMOD
1 ERROR [<SUBA> FTN95 v8.30.279]
NO ERRORS [<TST> FTN95 v8.30.279]
*** Compilation failed |
I wish to acknowledge the help of Steve Lionel (retd. from Intel). He pointed out the corresponding section of the F2008 standard on Usenet comp.lang.fortran.
Last edited by mecej4 on Fri Nov 23, 2018 10:15 am; edited 1 time in total |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Fri Nov 23, 2018 9:27 am Post subject: |
|
|
Thank you for the feedback. I have logged this for investigation. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Mon Feb 04, 2019 3:57 pm Post subject: |
|
|
This bug has now been fixed for the next release of FTN95. |
|
Back to top |
|
|
|
|
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
|