soccer jersey forums.silverfrost.com :: View topic - Allocate on assignment for CHARACTER variables
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: 61

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: 7996
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
PaulLaidler
Site Admin


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

PostPosted: Tue Aug 13, 2024 9:48 am    Post subject: Reply with quote

This feature has now been added for the next release of FTN95 but only for x64.
Back to top
View user's profile Send private message AIM Address
jlb



Joined: 21 Oct 2020
Posts: 61

PostPosted: Tue Aug 13, 2024 3:43 pm    Post subject: Reply with quote

Paul
Thank you very much for having added this feature.
Back to top
View user's profile Send private message
jlb



Joined: 21 Oct 2020
Posts: 61

PostPosted: Tue Aug 20, 2024 8:53 am    Post subject: Reply with quote

Paul
I have tried both code samples with the new FTN95 version 9.04.0.0. The version with FUNCTION (2nd sample) works, thank you, the version with SUBROUTINE (1st sample) raises the following exception at runtime:
Quote:
Unknown exception (c0000374) at address 7ff99e2ac399

Within file ntdll.dll
In RtlIsZeroMemory at address 119
In RtlIsZeroMemory at address E3
In _misaligned_access at address 492
In _misaligned_access at address 77A
In _misaligned_access at address AC65
In RtlGetCurrentServiceSessionId at address C95
In RtlFreeHeap at address 51
In _DEALLOCATE$ at address 69
Within file CLEARWIN64.DLL
In ILT+1625(??$parse_integer_from_string_J_W$$T__crt_strtoxYA_JQEB_W$$THQEAU__crt_locale_pointersZ) at address 2
Within file Simon1.exe
in SIMON~SIM at address 77


RAX = 394e54465c73746e RBX = 00000000c0000374 RCX = 5c73747365545c35 RDX = 652e316e6f6d6953
RBP = 0000000000405090 RSI = 0000000000000001 RDI = 00007ff99e317780 RSP = 000000000240fb00
R8 = 0000000000000000 R9 = 00007ff99d160000 R10 = 00007ff99d17aaa0 R11 = 0000000000620062
R12 = 0000000000000000 R13 = 0000000000000000 R14 = 0000000000000000 R15 = 0000000000000000

7ff99e2ac399) jmp 7ff99e2ac39b
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Aug 20, 2024 3:41 pm    Post subject: Reply with quote

jlb

Thanks. I will have another go at this.
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