Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29235 Discussions

catastrophic error: interaction between type constructor of base type and derived type definition

Ben_Lauwens
Beginner
1,203 Views
Hello

Testing the new version of the Fortran compiler for linux (Intel Fortran Compiler XE for applications running on IA-32, Version 12.0.0.084 Build 20101006), I encountered a catastrophic error with following code:

module tests
implicit none

type :: test
integer :: i
end type

interface test
module procedure new_test
end interface

type, extends (test) :: derived_test
real :: r
end type

interface derived_test
module procedure new_derived_test
end interface
contains
function new_test (i) result (a_test)
integer, intent (in) :: i
type (test) :: a_test
a_test % i = i
end function

function new_derived_test (i, r) result (a_test)
integer, intent (in) :: i
real, intent (in) :: r
type (derived_test) :: a_test
a_test % i = i
a_test % r = r
end function
end module

program testing
use tests
implicit none
class (test), allocatable :: a_test
allocate (a_test, source=test(1))
end program

output of compiler run:

ifort -g -O0 -c -o "src/error.o" "../src/error.f90"
../src/error.f90(38): error #6463: This is not a derived type name. [TEST]
class (test), allocatable :: a_test
-----------^
../src/error.f90(39): error #6404: This name does not have a type, and must have an explicit type. [A_TEST]
allocate (a_test, source=test(1))
--------------^
../src/error.f90: catastrophic error: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.
compilation aborted for ../src/error.f90 (code 1)
make: *** [src/error.o] Error 1

When I comment out the inherited type derived_test, the program compiles fine.
I hope that this error report is useful.
Greetz

Ben

0 Kudos
10 Replies
Kevin_D_Intel
Employee
1,203 Views
Thank you for the report and convenient reproducer, Ben. I reported this to Development (internal tracking id below) and willkeep you updated on the availability of a fix.

(Internal tracking id: DPD200163017)

(Resolution Update on 10/26/2011): This defect is fixed in the Intel Fortran Composer XE 2011 Update 7 (2011.1.1.256 - Linux)
0 Kudos
Kevin_D_Intel
Employee
1,203 Views

The Developer wrote that the root-cause of internal error is because TEST is overloaded as both a type name and as an interface name. While not illegal by itself, it is not an advised programming practice Changing one of these names will get rid of the error(s).

The internal error will be addressed in a future update.

0 Kudos
John4
Valued Contributor I
1,203 Views

It's not a matter of programming practice. Overriding the default structure constructor is a Fortran 2003 feature (and it's even listed in the New and Changed Features in the IFC XE 2011 Release Notes).

If the example provided by the OP is a good representation of the actual code, the easiest solution is to just get rid of the interface blocks (since they do exactly the same as the default structure constructors).

0 Kudos
Steven_L_Intel1
Employee
1,203 Views
I agree with John here - this is an explicit feature of the language that is newly supported in version 12. It could be we did not get it all right - it will get fixed.
0 Kudos
Kevin_D_Intel
Employee
1,203 Views

Beg your pardon for the oversight. I relayed this back to the developer.

0 Kudos
dougf
Beginner
1,203 Views
I just began using version 12.1 (on Windows) and am having a similar problem. Is this still on the list of bugs to be fixed?
0 Kudos
Steven_L_Intel1
Employee
1,203 Views
The bug reported in this thread is fixed in Update 7. If you are still seeing an issue, please start a new thread and attach a test case.
0 Kudos
Kevin_D_Intel
Employee
1,203 Views
Ben, just for formally close with you, the issue you submitted is fixed in the Intel Fortran Composer XE 2011 Update 7 (2011.1.1.256 - Linux) that was just posted on our Registration Center.
0 Kudos
dundar11
Beginner
1,203 Views
I am receiving similar error.
Actually it is really weird that I can declare derived type at main part of the code:
module structures_module
type structures
....
end type
interface structures
module procedure structures
end interface
program
use structures_module
type(structures) :: structure
end program
this part is just fine but at another module
module etc
use structures_module
contains
function test(structure)
type(structures):: structure
end function
when I try to compile it says for module etc function test : This is not a derived type [STRUCTURES]
i am using version 12.1.1.256
thanks.
0 Kudos
Steven_L_Intel1
Employee
1,203 Views
Please attach an actual source file that gets the error and not a paraphrase of what it looks like.
0 Kudos
Reply