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

Internal compiler error using GENERIC statement

Olsen__Oystein
Beginner
1,428 Views
I get an internal compiler error with ifort 12.1.1 when I call a type bound procedure using its generic name. It happens if the derived type is a component of another derived type.
The attached example demonstrates the problem. This does not happen with 12.1.0 nor with earlier compilers. I have tested this on openSUSE 11.4
0 Kudos
4 Replies
Kevin_D_Intel
Employee
1,428 Views
Thank you for the convenient reproducer. I confirmed the error and reported this to Development (internal tracking id below). I will keep this thread updated about a fix as I learn it.

(Internal tracking id: DPD200175492)

(Resolution Update on 5/20/2012): This defect is fixed in the Intel Fortran Composer XE 2011 Update 4 (2011.1.4.319 - Linux)
0 Kudos
Kevin_D_Intel
Employee
1,428 Views
This issue is fixed in the earlier Intel Fortran Composer XE 2011 Update 4 (2011.1.4.319 - Linux). Newer updates are available at this time.
0 Kudos
Sam_R_1
Beginner
1,428 Views
I get the exact same type of compilation error using Intel(R) Visual Fortran Composer XE 2011 Update 7 for Windows using Visual Studio 2008. I have reproduced the essential bug in the attached file. This only occurs when I try to place a derived type as a component of another type and then call one of the generic functions in the component type. Here is the source code contained in the attached file (which should be renamed to .f90 extension) module bug_test type,public :: CPP_model_term integer :: term_type = 0 !< describes which type of term is contained in the data structure, which is used for evaluating different equations with the same set of coefficients real :: a1 !< First CPP_model term coefficient, $ a_{1} $ real :: a2 !< Second CPP_model term coefficient, $ a_{2} $ real :: a3 !< Third CPP_model term coefficient, $ a_{3} $ real :: a4 !< Fourth CPP_model term coefficient, $ a_{4} $ real :: a5 !< Fifth CPP_model term coefficient, $ a_{5} $ real :: a6 !< Sixth CPP_model term coefficient, $ a_{6} $ real :: a7 !< Seventh CPP_model term coefficient, $ a_{7} $ contains ! model term evaluation procedures ! Generic Module Procedures for handling input of varying rank procedure,private :: Cp0_r0 => evaluate_term_Cp0_r0 procedure,private :: Cp0_r1 => evaluate_term_Cp0_r1 procedure,private :: Cp0_r2 => evaluate_term_Cp0_r2 generic,public :: Cp0 => Cp0_r0, Cp0_r1, Cp0_r2 end type !CPP_model_term type, public :: CPP_model real :: T_ref real :: P_ref real :: s_ref real :: h_ref real :: rho_ref real :: Rgas character(len=:),allocatable, public :: description !< variable-length string containing a text description of the model and its data source integer ,public :: nterms !< number of model terms in the model, used to allocate memory for type(CPP_model_term), public, dimension(:), allocatable :: terms !< allocatable array of of type CPP_model_term, containing all of the term data in the model contains procedure,public :: Cp0 => evaluate_Cp0 end type !CPP_model contains !module procedures ! \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ function evaluate_term_Cp0_r0(term,T) result (Cp0) class(CPP_model_term),intent(in) :: term !< CPP_model_term being evaluated at the specified Temperature real, intent(in) :: T !< Absolute Temperature to evaluate Cp0[Kelvin] real :: Cp0 !< Ideal Gas Specific Heat [J/mol-K], ${C_p^0}$ Cp0 = 0.0 ! initialize output result to zero !> Select the appropriate operation using the CPP model term variable term_type select case (term%term_type) case default stop 'evaluate_term_Cp0 :: term_type is unrecognized' case(1) ! term_type == 1, polynomial Cp0 = term%a1 * term%a4 * ( T/term%a3 )**(term%a2) case(2) ! term_type == 2, exponential Cp0 = term%a1 * term%a3 * ( term%a2/T )**2 * EXP(term%a2/T) / ( (1-EXP(term%a2/T))**2 ) case(3) ! term_type == 3, cosh-based Cp0 = term%a1 * ( T/term%a6 )**(term%a2) * (COSH(term%a3 * (T/term%a6)**(term%a4) ))**term%a5 * term%a7 case(4) ! term_type == 4, sinh-based Cp0 = term%a1 * ( T/term%a6 )**(term%a2) * (SINH(term%a3 * (T/term%a6)**(term%a4) ))**term%a5 * term%a7 end select end function ! ///////////////////////////////////////////////////////////////////////////////////////////////////////// ! \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ function evaluate_term_Cp0_r1(term,T) result (Cp0) class(CPP_model_term),intent(in) :: term !< CPP_model_term being evaluated at the specified Temperature real, dimension(:), intent(in) :: T !< Absolute Temperature to evaluate Cp0[Kelvin] real, dimension(:), allocatable :: Cp0 !< Ideal Gas Specific Heat [J/mol-K], ${C_p^0}$ allocate(Cp0(size(T))) ! allocate memory for intermediate result vector Cp0 = 0.0 ! initialize output result to zero !> Select the appropriate operation using the CPP model term variable term_type select case (term%term_type) case default stop 'evaluate_term_Cp0 :: term_type is unrecognized' case(1) ! term_type == 1, polynomial Cp0 = term%a1 * term%a4 * ( T/term%a3 )**(term%a2) case(2) ! term_type == 2, exponential Cp0 = term%a1 * term%a3 * ( term%a2/T )**2 * EXP(term%a2/T) / ( (1-EXP(term%a2/T))**2 ) case(3) ! term_type == 3, cosh-based Cp0 = term%a1 * ( T/term%a6 )**(term%a2) * (COSH(term%a3 * (T/term%a6)**(term%a4) ))**term%a5 * term%a7 case(4) ! term_type == 4, sinh-based Cp0 = term%a1 * ( T/term%a6 )**(term%a2) * (SINH(term%a3 * (T/term%a6)**(term%a4) ))**term%a5 * term%a7 end select end function !evaluate_term_Cp0_r1 ! ///////////////////////////////////////////////////////////////////////////////////////////////////////// ! \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ function evaluate_term_Cp0_r2(term,T) result (Cp0) class(CPP_model_term),intent(in) :: term !< CPP_model_term being evaluated at the specified Temperature real, dimension(:,:), intent(in) :: T !< Absolute Temperature to evaluate Cp0[Kelvin] real, dimension(:,:), allocatable :: Cp0 !< Ideal Gas Specific Heat [J/mol-K], ${C_p^0}$ allocate( Cp0(size(T,1),size(T,2)) ) ! allocate memory for intermediate result matrix Cp0 = 0.0 ! initialize output result to zero !> Select the appropriate operation using the CPP model term variable term_type select case (term%term_type) case default stop 'evaluate_term_Cp0 :: term_type is unrecognized' case(1) ! term_type == 1, polynomial Cp0 = term%a1 * term%a4 * ( T/term%a3 )**(term%a2) case(2) ! term_type == 2, exponential Cp0 = term%a1 * term%a3 * ( term%a2/T )**2 * EXP(term%a2/T) / ( (1-EXP(term%a2/T))**2 ) case(3) ! term_type == 3, cosh-based Cp0 = term%a1 * ( T/term%a6 )**(term%a2) * (COSH(term%a3 * (T/term%a6)**(term%a4) ))**term%a5 * term%a7 case(4) ! term_type == 4, sinh-based Cp0 = term%a1 * ( T/term%a6 )**(term%a2) * (SINH(term%a3 * (T/term%a6)**(term%a4) ))**term%a5 * term%a7 end select end function !evaluate_term_Cp0_r2 ! ///////////////////////////////////////////////////////////////////////////////////////////////////////// function evaluate_Cp0(mdl,T,debug_unit_in) result (Cp0) class(CPP_model),intent(in) :: mdl ! input reduced helmholtz function real, dimension(:), intent(in) :: T ! dimensional Temperature [Kelvin] integer, intent(in), optional :: debug_unit_in ! optional file unit to print debug data to real, dimension(:), allocatable :: Cp0 ! function output, Ideal Gas Specific Heat [J/mol-K] integer :: debug_unit ! file unit to send debug information to integer :: i = 0 !initialize counter variable to zero if (present(debug_unit_in)) then debug_unit = debug_unit_in ! set debug print unit to optional input else debug_unit = 0 ! default debug output to screen endif allocate(Cp0(size(T))) ! allocate memory for alpha_r result vector Cp0 = 0.0 ! initialize to zero do i = 1,mdl%nterms ! go through each term to evaluate alpha_r Cp0 = Cp0 + mdl%terms(i)%Cp0(T) ! evaluate and add result for ith term to alpha_r end do ! loop through evaluating each term in the model end function ! evaluate_Cp0 end module !bug_test
0 Kudos
Steven_L_Intel1
Employee
1,428 Views
I can't reproduce it in the current version 13.0 compiler. Update 7 is almost a year old.
0 Kudos
Reply