Hi,
I am trying turn an existing code into Oriented-Object.
I need to define a pointer procedure which points to a bound-type subroutine
The source code is provided below:
- the typedef_module.f90 module defines the derived-type variable and its bound procedure.
- the second_module.f90 module makes the pointer procedure affectation and the procedure call
- the main.f90 is the main program
The compilation/execution is acheived by the following command:
ifort -c typdef_module.f90; ifort -c second_module.f90; ifort main.f90 typdef_module.f90 second_module.f90; ./a.out
Program Main use TypeDef_Module ,only: MyType use Second_Module ,only: Action implicit none integer :: iinp, iout type(MyType) :: TypVar iinp = 5 call Action( TypVar, iinp, iout ) write(*,*) iout End Program
Module TypeDef_Module implicit none private public MyType Type :: MyType contains procedure ,nopass :: Fct End Type contains Subroutine Fct ( iinp, iout ) integer ,intent(in) :: iinp integer ,intent(out) :: iout iout = 2 * iinp End Subroutine End Module
Module Second_Module implicit none private public Action contains Subroutine Action ( TypVar, iinp, iout ) use TypeDef_Module ,only: MyType implicit none type(MyType) ,intent(in) :: TypVar integer ,intent(in) :: iinp integer ,intent(out) :: iout interface Subroutine Fct_Interface ( iinp, iout ) integer ,intent(in) :: iinp integer ,intent(out) :: iout End Subroutine end interface procedure(Fct_Interface) ,pointer :: funct funct => TypVar%Fct() call funct( iinp, iout ) End Subroutine End Module
This code leads to the following compilation error:
$ ifort -c second_module.f90 second_module.f90(19): error #6553: A function reference is invoking a subroutine subprogram. [FCT] funct => TypVar%Fct() --------------------^ second_module.f90(19): error #6402: prPromoteSym : Illegal KIND & CLASS mix [FCT] funct => TypVar%Fct() --------------------^ second_module.f90(19): error #7021: Name invalid in this context [FCT] funct => TypVar%Fct() --------------------^ second_module.f90: error #5270: Internal Compiler Error: symbol not a SYMTOK second_module.f90: catastrophic error: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error. compilation aborted for second_module.f90 (code 1)
Is there something I am doing wrong ?Thanks for your help.
By the way I am using:
$ ifort -V Intel Fortran Compiler XE for applications running on IA-32, Version 12.1.1.256 Build 20111011 Copyright (C) 1985-2011 Intel Corporation. All rights reserved. FOR NON-COMMERCIAL USE ONLY



