I recently came across a problem with the Intel Fortran compiler, where building code that renames a Fortran 2003 derived type from a different module leads to a compiler error:
module type_a_mod type :: type_a contains final :: type_a_destructor end type type_a contains subroutine type_a_destructor(self) type(type_a) :: self end subroutine type_a_destructor end module type_a_mod module type_rename_mod use type_a_mod, only: type_b => type_a, type_c => type_a private public :: type_b, type_c end module type_rename_mod program test_rename use type_rename_mod, only: type_b end program test_rename
Intel Fortran v2021.6.0 fails with error message
error #6402: prPromoteSym : Illegal KIND & CLASS mix [TYPE_A_DESTRUCTOR]
However, it will compile this code when either the second type renaming statement ("type_c => type_a") or the "private" declaration in "type_rename_mod" are disabled.
I tried different compiler versions - Intel Fortran v17.0.4, Intel Fortran v18.0.1, gfortran v9.2.0, and gfortran v12.1.0 are able to compile the code, but Intel Fortran v18.104.22.1681, Intel Fortran v22.214.171.1244, and Intel Fortran v2021.6.0 fail. This looks like a compiler bug to me.