I stumbled upon a compiler bug. The following code worked with former compilers but crashes during compilation now (ifort 2021.7.0 / oneAPI 2022.3.1).
module M_BAR
type, public :: T_BAR
integer, public :: member(3) = [0,0,0]
end type
type, public, extends(T_BAR) :: T_BAR_HELPER
end type
#if 0
!Workaround
type(T_BAR_HELPER), parameter, public :: OBJ_123_help = T_BAR_HELPER([1,2,3])
type(T_BAR), parameter, public :: OBJ_123 = OBJ_123_help%T_BAR
#else
type(T_BAR), parameter, public :: OBJ_123 = T_BAR([1,2,3])
#endif
interface T_BAR
module procedure constructorExtension
end interface
contains
pure function constructorExtension(a,b,c)
integer, intent(in) :: a,b,c
type(T_BAR) :: constructorExtension
constructorExtension%member(:) = [a,b,c]
end function constructorExtension
end module
!---------------------------------------------
program TESTPROG
use M_BAR
type(T_BAR) :: BB = OBJ_123
type(T_BAR) :: CC
CC = OBJ_123
write(*,*)CC%member(:)
end program TESTPROG
It seems to be a problem with the constructor interface. It works to without the interface, but that would break a lot of code in my case. The workaround with the dummy-type seems to work so far.
Greetings
Wolf
Hi,
good news, finally the fix made it into release 2023.1. Please try it on your side.
This issue has been resolved and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.
Best
Tobias
連結已複製
@Wolf_W_ ,
Take it that an internal compiler error (ICE) in encountered now and that's what you mean by, "The following code worked with former compilers but crashes during compilation .."?
ICEs are pernicious and it may help to state them as much if that's what you face to get added attention.
Hi Wolf,
happy new year!
We fixed the ICE in our internal builds and it will be part of a future release. I will come back to you as soon it is released.
Thanks again for reporting the issue to us!
Best
Tobias
Hi,
good news, finally the fix made it into release 2023.1. Please try it on your side.
This issue has been resolved and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.
Best
Tobias
