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 

Allocate on assignment for CHARACTER variables

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



Joined: 21 Oct 2020
Posts: 45

PostPosted: Wed Sep 20, 2023 2:39 pm    Post subject: Allocate on assignment for CHARACTER variables Reply with quote

While trying to use the "allocate on assignment" feature for CHARACTER variables implemented with FTN95 version 8.95, both following examples fail to compile with version 8.97.2. The error output seems to me contradictory.
Code:
PROGRAM Simon
IMPLICIT NONE
CHARACTER (LEN=:), ALLOCATABLE :: Says

CALL Sim('clap hands', Says)
WRITE(*,*) Says

CONTAINS

SUBROUTINE Sim(What, Out)
  IMPLICIT NONE
  CHARACTER (LEN=*), INTENT(IN):: What
  CHARACTER (LEN=:), INTENT(OUT), ALLOCATABLE :: Out
  Out = 'Simon says '//What
END SUBROUTINE Sim

END PROGRAM Simon

Quote:
error 1234 - CHARACTER variable OUT must be ALLOCATABLE
error 941 - OUT is a scalar dummy argument and so cannot be ALLOCATABLE

Code:
PROGRAM Simon
IMPLICIT NONE
CHARACTER (LEN=:), ALLOCATABLE :: Says

Says=Sim('clap hands')
WRITE(*,*) Says

CONTAINS

FUNCTION Sim(What) RESULT(Out)
  IMPLICIT NONE
  CHARACTER (LEN=*), INTENT(IN):: What
  CHARACTER (LEN=:), ALLOCATABLE :: Out
  Out = 'Simon says '//What
END FUNCTION Sim

END PROGRAM Simon

Quote:
error 456 - ALLOCATABLE is an illegal attribute specifier for a RESULT variable such as (RESULT of SIMON~SIM)
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Sep 20, 2023 2:56 pm    Post subject: Reply with quote

It looks like the use of CHARACTER variables in this way has not be considered.

I have added these to the list of missing features.
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