View previous topic :: View next topic |
Author |
Message |
jlb
Joined: 21 Oct 2020 Posts: 61
|
Posted: Wed Sep 20, 2023 2:39 pm Post subject: Allocate on assignment for CHARACTER variables |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7996 Location: Salford, UK
|
Posted: Wed Sep 20, 2023 2:56 pm Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7996 Location: Salford, UK
|
Posted: Tue Aug 13, 2024 9:48 am Post subject: |
|
|
This feature has now been added for the next release of FTN95 but only for x64. |
|
Back to top |
|
|
jlb
Joined: 21 Oct 2020 Posts: 61
|
Posted: Tue Aug 13, 2024 3:43 pm Post subject: |
|
|
Paul
Thank you very much for having added this feature. |
|
Back to top |
|
|
jlb
Joined: 21 Oct 2020 Posts: 61
|
Posted: Tue Aug 20, 2024 8:53 am Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7996 Location: Salford, UK
|
Posted: Tue Aug 20, 2024 3:41 pm Post subject: |
|
|
jlb
Thanks. I will have another go at this. |
|
Back to top |
|
|
|