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 

Runtime error with array-valued function

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



Joined: 17 Dec 2007
Posts: 9

PostPosted: Sat Jun 28, 2008 4:48 pm    Post subject: Runtime error with array-valued function Reply with quote

The program below, using an array-valued function, gives runtime errors with FTN95 5.20.1 and 5.21.0 no matter what options I use but works with my other compilers and I believe it is well-formed. With a simple ftn95 <file> /LINK build it gives a stack overflow and with a /FULL_DEBUG /CHECKMATE build I get:

Access Violation
The instruction at address 1000429a attempted to write to location 20202020

100041f1 __CCOPY_U [+00a9]
ARRAY_OF - in file a.f90 at line 5 [+015c]
TEST - in file a.f90 at line 19 [+004e]

Making the return value a fixed length character or a scalar REAL eliminates the errors. Any ideas?

Code:
FUNCTION ARRAY_OF( Arg )
  IMPLICIT NONE
  CHARACTER(*), INTENT(IN) :: Arg
  CHARACTER( LEN( Arg ) ) :: ARRAY_OF( 1 )
  ARRAY_OF( 1 ) = Arg
END FUNCTION ARRAY_OF


PROGRAM TEST
  CHARACTER(4) :: S = 'ABCD', SA(1)

  INTERFACE
  FUNCTION ARRAY_OF( Arg )
    CHARACTER(*), INTENT(IN) :: Arg
    CHARACTER( LEN( Arg ) ) :: ARRAY_OF( 1 )
  END FUNCTION ARRAY_OF
  END INTERFACE

  SA = ARRAY_OF( S )
  PRINT *, SA(1)
END PROGRAM
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Jun 30, 2008 12:36 pm    Post subject: Reply with quote

This looks like a bug in FTN95. We will investigate and report back as soon as we can.
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