- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
consider the program below. It defines an extended derived type and tries to
fill in one procedure via a contained function. I can imagine that this is
not standard-conforming, as the function has access to the variables from the
main program, but the error message I got was rather puzzling:
"The specified interface is not declared [ACTUAL_DERIV]"
It took me quite a while to figure out what was wrong, as the interface seemed to be perfectly okay.
The solution is of course to put the definition of ode_actual_t and the function in a module, but that
is not suggested by the error message. (If this has been improved in Intel Fortran 12.x, then I apologize
for the noise.)
Regards,
Arjen
-----
! question.f90 --
! Can actual_derive not be part of the program? Should it be a module procedure?
!
module ode_types
implicit none
private
integer, parameter, public :: wp = kind(1.0)
type, abstract, public :: ode_system_t
integer :: size = 0
contains
procedure(ode_derivative), deferred, pass(this) :: deriv
end type ode_system_t
abstract interface
function ode_derivative( this, x, time ) result(deriv)
import :: ode_system_t, wp
class(ode_system_t) :: this
real(wp), dimension(:) :: x
real(wp) :: time
real(wp), dimension(size(x)) :: deriv
end function ode_derivative
end interface
end module ode_types
! test --
! Simple test program
!
program test
use ode_types
implicit none
type, extends(ode_system_t) :: ode_actual_t
contains
procedure :: deriv => actual_deriv
end type ode_actual_t
type(ode_actual_t) :: ode
contains
function actual_deriv( this, x, time ) result(deriv)
class(ode_actual_t) :: this
real(wp), dimension(:) :: x
real(wp) :: time
real(wp), dimension(size(x)) :: deriv
end function actual_deriv
end program test
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Arjen,
The Fortran standard states The procedure-name [of a type bound procedure] shall be the name of an accessible module procedure or an external procedure that has an explicit interface., so a contained procedure from the main program is not allowed to be a type bound procedure.
I agree that the error message could be clearer. What this error message is trying to say is that the compiler can't find a procedure or interface for a procedure matching the name actual_deriv. It doesn't know why it can't find the procedure or interface. Keeping that in mind, do you have any suggestions on how to make the error message so the issue would have been clearer?
Thanks,
Annalee
Intel Developer Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
weill (at least in retrospect ;)).
So, my suggestion is something like:
The actual procedure for this type-bound procedure should be a module procedure or an external procedure with an explicit interface [DERIV]
(I suggest using the type-bound name, rather than the name given after the "=>", as that is where you
should correct things)
Regards,
Arjen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have escalated this request to the developers. The issue number is DPD200232581. I will post any updates I receiveto this thread.
Regards,
Annalee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We are planning to improve the error message in a future release (not the one scheduled for later this year).
Regards,
Annalee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This bug was fixed in the recent Composer XE 2013 SP1 release, released in early September ( version 14.0 of the compiler )
ron

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page