- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
when I try to compile the attached code I see the following error:
ifort test-ifort.f90 -o test-ifort
/tmp/ifort9y3yNI.o:(.rodata+0x50): undefined reference to `i_rhs_'
however up to my understanding the code is correct (and it compiles
with gfortran).
ifort -V
Intel Fortran Intel 64 Compiler XE for applications running on
Intel 64, Version 12.0.4.191 Build 20110427
Is this a compiler problem?
Thank you,
Marco
when I try to compile the attached code I see the following error:
ifort test-ifort.f90 -o test-ifort
/tmp/ifort9y3yNI.o:(.rodata+0x50): undefined reference to `i_rhs_'
however up to my understanding the code is correct (and it compiles
with gfortran).
ifort -V
Intel Fortran Intel 64 Compiler XE for applications running on
Intel 64, Version 12.0.4.191 Build 20110427
Is this a compiler problem?
Thank you,
Marco
[fortran]module mod_ti
implicit none
public :: c_ode, i_rhs
private
type, abstract :: c_ode
contains
procedure(i_rhs), deferred, pass(uuu) :: rhs
end type c_ode
abstract interface
pure subroutine i_rhs(tnd,uuu)
import :: c_ode
implicit none
class(c_ode), intent(in) :: uuu
class(c_ode), intent(out) :: tnd
end subroutine i_rhs
end interface
end module mod_ti
!--------------------------------------------------------------------
module mod_ee
use mod_ti, only: c_ode, i_rhs
implicit none
public :: ee
contains
pure subroutine ee(ynew,ynow)
class(c_ode), intent(in) :: ynow
class(c_ode), intent(out) :: ynew
class(c_ode), allocatable :: tnd
! if the following two lines are eliminated the code compiles
allocate(tnd,mold=ynow)
deallocate(tnd)
call ynow%rhs(ynew)
end subroutine ee
end module mod_ee
!--------------------------------------------------------------------
module mod_pb
use mod_ti, only: c_ode, i_rhs
implicit none
public :: t_ode, pb_rhs
type, extends(c_ode) :: t_ode
real :: y(3)
contains
procedure, pass(uuu) :: rhs => pb_rhs
end type t_ode
contains
pure subroutine pb_rhs(tnd,uuu)
class(t_ode), intent(in) :: uuu
class(c_ode), intent(out) :: tnd
select type(tnd)
type is(t_ode)
tnd%y = -3.0*uuu%y
end select
end subroutine pb_rhs
end module mod_pb
!--------------------------------------------------------------------
program ode_test
use mod_pb, only: t_ode
use mod_ee, only: ee
implicit none
type(t_ode) :: a, b
a%y = (/ 1.0 , 2.0 , 3.0 /)
call ee(b,a)
end program ode_test
[/fortran]
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it is a compiler problem that is fixed in a future update (probably September). The bug involves an abstract type with a deferred type-bound procedure. In some cases, the compiler erroneously generates an external reference to the deferred procedure name. The issue ID for this is DPD200169377 in case you want to watch for it in the list of fixed bugs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, thank you.
Marco
Marco
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page