Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Finalization of derived types

drraug
Beginner
802 Views

In Fortran 2003 standard finalization of derived types is proposed by "final :: " keyword, that could be included in the specification of type. Consider the following example

[fortran]module test_mod
 type mytyp
  double precision, allocatable :: a(:,:)
 contains
  final :: mytyp_finalize
 end type
contains
 subroutine mytyp_finalize(arg)
  implicit none
  type(mytyp),intent(inout) :: arg
  if(allocated(arg%a))deallocate(arg%a)
 end subroutine
end module
[/fortran]

I have the following error during compilation.

[bash]$ uname -a
Linux localhost 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:58:03 UTC 2009 x86_64 GNU/Linux

$ ifort -V
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1    Build 20091130 Package ID: l_cprof_p_11.1.064
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.
FOR NON-COMMERCIAL USE ONLY

$ ifort t.f90
t.f90(5): error #5082: Syntax error, found '::' when expecting one of: ( % : . = =>
  final :: mytyp_finalize
--------^
t.f90(5): error #6590: This statement is not permitted as a statement within a derived-type-def
  final :: mytyp_finalize
--^
t.f90(6): error #8295: The type bound procedure part in derived type definition must have at least one procedure binding statement.
 end type
-^
compilation aborted for t.f90 (code 1)
[/bash]

Does this mean that finalization is not avaliable in the current version of Intel Fortran Compiler? Do you plan to add finalization in the nearest future?

0 Kudos
1 Solution
Ron_Green
Moderator
802 Views

correct, FINAL is not currently supported. This will be coming in the next major version of the compiler, tendatively scheduled for fall 2010.

ron

View solution in original post

0 Kudos
2 Replies
Ron_Green
Moderator
803 Views

correct, FINAL is not currently supported. This will be coming in the next major version of the compiler, tendatively scheduled for fall 2010.

ron

0 Kudos
drraug
Beginner
802 Views
Thank you, Ron!
0 Kudos
Reply