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 

Array constructor issue

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



Joined: 25 Oct 2007
Posts: 7
Location: California

PostPosted: Mon Dec 17, 2007 3:40 pm    Post subject: Array constructor issue Reply with quote

In the following test, FTN95 seems to lose track of the fact that variable I is used as a ac-do-variable in the array constructor:

program init_bug
implicit none

integer :: i
character(11), parameter :: string="hello world"

! This compiles:
character, parameter :: up_string(len (string)) = &
(/ (string(i:i), i=1, len (string)) /)

! Yet this does not compile:
integer, parameter :: bytes(len (string)) = &
(/ (iachar (string(i:i)), i=1, len (string)) /)

print *, string
print *, up_string
print *, bytes

end program

FTN95 reports the following:

[FTN95/Win32 Ver. 5.10.0 Copyright (c) Silverfrost Ltd 1993-2007]
0012) integer, parameter :: bytes(len (string)) = &
0013) (/ (iachar (string(i:i)), i=1, len (string)) /)
*** I is not a PARAMETER, so cannot appear in an initialisation expression

1 ERROR [salford_init_bug1.F90] - Compilation failed.

Playing around with the example a bit, I tried making I a PARAMETER. (This should not be needed, and may be illegal.) Depending on case FTN95 either generated bad code or simply crashed!
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Dec 17, 2007 3:54 pm    Post subject: Reply with quote

Yes this looks like a bug.

For the moment you could remove the parameter attribute and do the assignment at via an executable statement at runtime.
Back to top
View user's profile Send private message AIM Address
wws



Joined: 25 Oct 2007
Posts: 7
Location: California

PostPosted: Mon Dec 17, 2007 10:57 pm    Post subject: Reply with quote

Thank you, Paul. Consider this a FYI, and not a critical need.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Dec 18, 2007 8:09 am    Post subject: Reply with quote

For a work-around you could probably use "/ignore 538" on the command line in this context.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Wed Dec 19, 2007 8: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
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