- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
when i call a function which result a derived-type with a final procedure
then the compiling collapsed with just a reminder of "catastrophic error"
may this post help someones save some time
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's a compiler bug. Please provide us with a source that demonstrates the problem and tell us the exact compiler version and compiler options you are using.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Intel) wrote:
It's a compiler bug. Please provide us with a source that demonstrates the problem and tell us the exact compiler version and compiler options you are using.
!call a function which result a derived-type with a final procedure
!the compiling would collapsed with just 'catastrophic error'
module abs
type:: sa
real(8):: a
end type sa
type:: sb
real(8),allocatable:: b(:)
contains
final:: cancel
end type sb
contains
subroutine cancel(this)
type(sb):: this
end subroutine
end module
module classpointer
use abs
type:: proptr
procedure(fca),pointer,nopass:: ptr
end type
type:: pointercontainer
real(8),pointer,dimension(:):: ptr
procedure(fca),pointer:: fp
type(proptr),dimension(2):: fpset
contains
procedure:: init
end type pointercontainer
abstract interface
function fca(this,a)
import
class(pointercontainer):: this
type(sa):: a
type(sb):: fca
end function
end interface
contains
subroutine init(this)
class(pointercontainer):: this
this%fpset(1) %ptr => fc
this%fpset(2) %ptr => fc
this%fp => this %fpset(2) %ptr
end subroutine
function fc(this,a) result(dd)
class(pointercontainer):: this
type(sa):: a
type(sb):: dd
allocate(dd%b(2))
dd %b= 2.d0
print*, 'smile'
end function
end module classpointer
program testMemberFunction
use classpointer
implicit none
type(pointercontainer):: p
type(sa):: a
call p%init
print*, p%fp(a)
end program testMemberFunction
don't know how to use this forum......
the key is the line "final:: cancel" in moduel abs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, that was fine. I can reproduce the problem and will send it on to the developers. Issue ID is DPD200414609.
However, the program is incorrect - a current version of the compiler complains:
U697080.f90(70): error #5514: A derived type I/O list item that contains a pointer or an allocatable component requires a user-defined derived-type input/output procedure.
print*, p%fp(a)
----^
The result of fp(a) is type sb that contains an allocatable component. The language therefore requires that type sb have a user-defined derived type I/O procedure.
This is unrelated to the internal compiler error, but I wanted to point it out anyway.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Intel) wrote:thanks, my compiler fails to capture this error!
Thanks, that was fine. I can reproduce the problem and will send it on to the developers. Issue ID is DPD200414609.
However, the program is incorrect - a current version of the compiler complains:
U697080.f90(70): error #5514: A derived type I/O list item that contains a pointer or an allocatable component requires a user-defined derived-type input/output procedure.
print*, p%fp(a)
----^The result of fp(a) is type sb that contains an allocatable component. The language therefore requires that type sb have a user-defined derived type I/O procedure.
This is unrelated to the internal compiler error, but I wanted to point it out anyway.
this forum is awesome and i learned much from it. it's my pleasure to help the others
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I expect this bug to be fixed in Update 2.

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