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

Illegal KIND & CLASS mix error when renaming Fortran 2003 derived type

whayek
Beginner
756 Views

Hi,

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 v19.0.5.281, Intel Fortran v19.1.3.304, and Intel Fortran v2021.6.0 fail. This looks like a compiler bug to me.

0 Kudos
1 Solution
Ron_Green
Moderator
731 Views

Bug ID is CMPLRLLV-38497


Thank you for sending this to us.


View solution in original post

0 Kudos
4 Replies
Ron_Green
Moderator
738 Views

yes, looks like a bug.  We'll get a bug report started.

0 Kudos
Ron_Green
Moderator
732 Views

Bug ID is CMPLRLLV-38497


Thank you for sending this to us.


0 Kudos
whayek
Beginner
714 Views

Great, thanks, Ron!

0 Kudos
Ron_Green
Moderator
285 Views

@whayek this bug is fixed in the 2024.1.0 compiler.  

Reply