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

Internal compiler error with generic procedure

johnyb_
New Contributor I
604 Views
With the following code, i get an internal compiler error C0000005:

[fortran]module mtest type T1 integer :: i contains procedure, private :: calc_int procedure, private :: calc_real generic :: calc => calc_int, calc_real end type type T2 type(T1) :: my_t1 end type contains integer function calc_int(this, i) class(T1) :: this integer :: i calc_int = this%i + i end function integer function calc_real(this, r) class(T1) :: this real :: r calc_real = this%i + int end function end module mtest program test use mtest type(T2) :: a_t2 a_t2%my_t1%i = 7 print *, a_t2%my_t1%calc(5) end program

[/fortran]This is the command line, showing also the compiler version [plain]C:\TEMP>ifort test.f90 Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.1.1.258 Build 20111011 Copyright (C) 1985-2011 Intel Corporation. All rights reserved. fortcom: Fatal: There has been an internal compiler error (C0000005). compilation aborted for test.f90 (code 1) [/plain]
gfortran 4.8, from trunk mid-may,compiles the code and it executes giving the expected result (12)

This isa very much reduced extract from the real code, where a_t2 is a pointer inside another derived type.
I stumbled upon this when I converted an overloaded procedure "calc" to a generic, typebound procedure.

It may be that my code is non-standard, but I have only these two compilers at hand to test it

Johny
0 Kudos
1 Solution
Robert_van_Amerongen
New Contributor III
604 Views
Johny,

I compiled your program and it worked fine! The answer is 12.
I use the most recent compiler version(package 325). I can not see whether that is an explanation for this behaviour.

Robert

View solution in original post

0 Kudos
3 Replies
Robert_van_Amerongen
New Contributor III
605 Views
Johny,

I compiled your program and it worked fine! The answer is 12.
I use the most recent compiler version(package 325). I can not see whether that is an explanation for this behaviour.

Robert
0 Kudos
johnyb_
New Contributor I
604 Views
Robert,

thank you for taking the time to test this.
So it seems that it is a bug in the compiler that has been corrected since we installed it.
I see that our installation is "update 7" whereas the current one is "update 10".
I'll see to get the most recent update installed and test my reduced case as well as the full procedure that uncovered the problem

Thanks again for your help

Johny
0 Kudos
johnyb_
New Contributor I
604 Views
I can confirm that with update 10 my test case as well as the code that first triggered the bug do compile now.

Johny
0 Kudos
Reply