Does ifort 15.0.2 know about character type?

Hello Everyone,

I’m trying to compile a code where I defined

type(character(len=30)), allocatable, dimension(:) :: solid_name_start, solid_name_end`

I’m compiling with intel fortran ifort 15.0.2.
It gives the following error

error #6457: This derived type name has not been declared.   [CHARACTER]

type(character(len=30)), allocatable, dimension(:) :: solid_name_start, solid_name_end

Is the problem related to my code or just to the old ifort version?
Is there anything I can do to downgrade the code ?
Unfortunately I’ve no access to more updated ifort version…

Thank you very much

character is an intrinsic data type, no need for the extra type(...) declaration.

character(len=30), allocatable, dimension(:) :: solid_name_start, solid_name_end

Thank you.
It’s strange gfortran 11 didn’t complain about that.

Gfortran 11 was released about two years ago. IFort 2015 was released in late 2014. Your code uses a parameterized derived type, which was probably not implemented in IFort 2015, or was just making its appearance for the first time.

Got it. Thank you so much.

I think the reason for this is that later Fortran standards allow the use of intrinsic types with the type() declaration style, e.g.

type(integer) :: a

which is equivalent to

integer :: a

Your older version of ifort clearly does not support this but the newer gfortran does.

Is it, however, an alias for intrinsic type? If so, I’d guess that a DT bearing intrinsic type name is forbidden.

@Rob777 , in case you didn’t see this thread:

Yes, it is equivalent and yes you therefore can’t name a DT with an intrinsic type name.

Yes, that is the likely case: the extension to allow the type statement with intrinsic types, something that was expected to help with “machine” generated code, was added in Fortran 2008 which was likely not implemented in the compiler version used by OP.

The indicated use conforms and the compiler now obliges:

   type(character(len=30)), allocatable :: s(:)
   allocate( s(2) )
   print *, len(s)
C:\temp>ifort /standard-semantics p.f90
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.6.0 Build 20220226_000000
Copyright (C) 1985-2022 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.30.30706.0
Copyright (C) Microsoft Corporation.  All rights reserved.



Where is the “parameterized derived type”?

Thanks, I’m aware that intel one API is now free, but I’m compiling the program on a HPC cluster where I’m only an user without any rights to install or even upload anything.

If this machine can connect to intel’s servers to fetch the package, you can install it to your home directory without any special perms required.

If type(intrinsic-type) had not been equivalent of intrinsic-type declaration, it could have been recognized as a PDT. And apparently it was recognized as such by the old ifort version. Change just one letter to get perfectly valid code:

type charakter(len)
  integer, len :: len
  real :: a(len)
end type charakter

type(charakter(len=20)), allocatable :: der(:)
1 Like