Silverfrost Forums

Welcome to our forums

Allocatable character strings

14 Jun 2017 12:36 #19751

The following program (about allocatable character strings) works fine under Gfortran, but in Silverfrost it complains about ' Colon found where not expected'.

PROGRAM test

IMPLICIT NONE

CHARACTER(len=:), allocatable :: CH


ALLOCATE(character(len=32) :: CH)
CH='HELLO'
print*,'ch=',CH

END PROGRAM test

[/quote]

14 Jun 2017 2:18 #19752

Your program uses a Fortran 2003 feature that FTN95, being mostly a Fortran 95 compiler, does not support.

$ gfortran -std=f95 ach.f90
ach.f90:5:15:

 CHARACTER(len=:), allocatable :: CH
               1
Error: Fortran 2003: deferred type parameter at (1)
ach.f90:8:9:

 ALLOCATE(character(len=32) :: CH)
         1
Error: Fortran 2003: typespec in ALLOCATE at (1)
ach.f90:9:2:

 CH='HELLO'
  1
Error: Symbol 'ch' at (1) has no IMPLICIT type
25 Feb 2019 7:29 #23278

This Fortran 2003 feature has now been added to FTN95 for its next release.

Please login to reply.