- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In our Fortran project we have got quite many "internal compiler error" errors since we started using OOP features more often.
Usually this happens due to the mistake in the code. But still it is really annoying to search for this mistake because the compiler does not help you. It might even point you to a wrong file.
Today I got the "internal compiler error" again. But I was not able to find a mistake in my code. So I decided to prepare a small example project to reproduce this error. Please find it below.
The code seems fine to me. But the compiler produces an error:
1> myStruct = realC%Compute()
1>^
1>Invalid_sym_id for SETMYINTERFACEB%COMPUTEA%COM, 0
1>[ Aborting due to internal error. ]
The funny thing is if I comment out "ComputeB" function at all places, the "internal error" will be gone. It is funny because "ComputeB" function is never used.
I use the latest Intel Fortran Compiler XE 13.1 for Windows (Update 5, Version 2013.5.198).
[fortran]
module MyStructure_m
implicit none
private
type, public :: MyStructure_t
real*8 :: dummy
end type MyStructure_t
end module MyStructure_m
module MyInterfaceA_m
implicit none
private
type, public, abstract :: MyInterfaceA_t
private
contains
procedure(ComputeA), public, deferred :: ComputeA
procedure(ComputeB), public, deferred :: ComputeB
end type MyInterfaceA_t
abstract interface
function ComputeA(this) result(myStruct)
use MyStructure_m
import :: MyInterfaceA_t
class(MyInterfaceA_t), intent(in) :: this
type(MyStructure_t) :: myStruct
end function ComputeA
function ComputeB(this) result(myStruct)
use MyStructure_m
import :: MyInterfaceA_t
class(MyInterfaceA_t), intent(in) :: this
type(MyStructure_t) :: myStruct
end function ComputeB
end interface
end module MyInterfaceA_m
module MyInterfaceB_m
use MyStructure_m
use MyInterfaceA_m
implicit none
private
type, abstract, public :: MyInterfaceB_t
private
class(MyInterfaceA_t), allocatable :: interfaceA
contains
procedure :: ComputeA => ComputeA
procedure :: ComputeB => ComputeB
end type MyInterfaceB_t
contains
function ComputeA(this) result(myStruct)
class(MyInterfaceB_t), intent(in) :: this
type(MyStructure_t) :: myStruct
myStruct = this%interfaceA%ComputeA()
end function ComputeA
function ComputeB(this) result(myStruct)
class(MyInterfaceB_t), intent(in) :: this
type(MyStructure_t) :: myStruct
myStruct = this%interfaceA%ComputeB()
end function ComputeB
end module MyInterfaceB_m
module RealInterfaceA_m
implicit none
private
type, public, abstract :: RealInterfaceA_t
private
contains
procedure(GetMyInterfaceB), deferred, public :: GetMyInterfaceB
procedure(SetMyInterfaceB), deferred, public :: SetMyInterfaceB
end type RealInterfaceA_t
abstract interface
function GetMyInterfaceB(this) result(interfaceB)
use MyInterfaceB_m
import :: RealInterfaceA_t
class(RealInterfaceA_t), intent(in) :: this
class(MyInterfaceB_t), pointer :: interfaceB
end function GetMyInterfaceB
subroutine SetMyInterfaceB(this, interfaceB)
use MyInterfaceB_m
import :: RealInterfaceA_t
class(RealInterfaceA_t), intent(inout) :: this
class(MyInterfaceB_t), target, intent(in) :: interfaceB
end subroutine SetMyInterfaceB
end interface
end module RealInterfaceA_m
module RealInterfaceB_m
use RealInterfaceA_m
use MyInterfaceB_m
use MyStructure_m
implicit none
private
type, public, abstract, extends(RealInterfaceA_t) :: RealInterfaceB_t
private
class(MyInterfaceB_t), pointer :: interfaceB
contains
procedure :: GetMyInterfaceB => GetMyInterfaceB
procedure :: SetMyInterfaceB => SetMyInterfaceB
end type RealInterfaceB_t
contains
function GetMyInterfaceB(this) result(interfaceB)
class(RealInterfaceB_t), intent(in) :: this
class(MyInterfaceB_t), pointer :: interfaceB
interfaceB => this%interfaceB
end function GetMyInterfaceB
subroutine SetMyInterfaceB(this, interfaceB)
class(RealInterfaceB_t), intent(inout) :: this
class(MyInterfaceB_t), target, intent(in) :: interfaceB
this%interfaceB => interfaceB
end subroutine SetMyInterfaceB
end module RealInterfaceB_m
module RealC_m
use RealInterfaceB_m
use MyStructure_m
implicit none
private
type, public, extends(RealInterfaceB_t) :: RealC_t
private
contains
procedure, public :: Compute => Compute
end type RealC_t
contains
function Compute(this) result(myStruct)
use MyInterfaceB_m
class(RealC_t), intent(in) :: this
type(MyStructure_t) :: myStruct
class(MyInterfaceB_t), pointer :: interfaceB
interfaceB => this%GetMyInterfaceB()
myStruct = interfaceB%ComputeA()
end function Compute
end module RealC_m
program IntelCompilerErrorF
use RealC_m
use MyStructure_m
implicit none
type(MyStructure_t) :: myStruct
type(RealC_t) :: realC
myStruct = realC%Compute()
end program IntelCompilerErrorF
[/fortran]
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've seen this problem before. It was found and fixed for a release planned for a couple of months from now.

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