http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52111
Bug #: 52111
Summary: [OOP] procedure pointer with polymorphic passed dummy
argument
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
I declare a procedure pointer in an abstract type
>> procedure(solve_gen), pointer :: solve
with procedure interface
>> abstract interface
>> subroutine solve_gen(this, val)
>> import :: solverAbstract_t
>> class(solverAbstract_t), intent(inout) :: this
>> integer, intent(inout) :: val
>> end subroutine
>> end interface
Class solver_t is a subclass of solverAbstract_t.
Now I want solve to point to
>> subroutine solveLeft_sub(this, val)
>> class(solver_t), intent(inout) :: this
>> integer, intent(inout) :: val
>>
>> write(*,*) 'i solve left'
>> end subroutine
Compiling my program with this classes fails with:
>>tatanka@tippi:~/tmp$ gfortran main.f90
>>main.f90:66.22:
>>
>> this%solve => solveLeft_sub
>> 1
>>Error: Interface mismatch in procedure pointer assignment at (1): Type/rank
>>>>mismatch in argument 'this'
>>main.f90:68.22:
>>
>> this%solve => solveRight_sub
>> 1
>>Error: Interface mismatch in procedure pointer assignment at (1): Type/rank
>>>>mismatch in argument 'this'
>>main.f90:74.6:
>>
>> use m_solver
>> 1
>>Fatal Error: Can't open module file 'm_solver.mod' for reading at (1): No
>>such >>file or directory
I found this bug in:
>>GNU Fortran (GCC) 4.7.0 20120131 (experimental)
and in
>>GNU Fortran (GCC) 4.7.0 20120120 (experimental).
In
>>GNU Fortran (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
program works fine.
I also tested the bug on cray with
>>hpcatism@eslogin002:~> ftn --version
>>/opt/cray/xt-asyncpe/5.06/bin/ftn: INFO: Compiling with
>>>>CRAYPE_COMPILE_TARGET=native.
>>/opt/cray/cce/8.0.1/cftn/x86-64/bin/ftn_driver.exe: invalid option -- '-'
On cray program also compiled fine and program works.