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

Regression for IFORT 2021.7.0 with parameter and constructor

Wolf_W_
New Contributor I
855 Views

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

0 Kudos
1 Solution
TobiasK
Moderator
480 Views

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


View solution in original post

0 Kudos
5 Replies
FortranFan
Honored Contributor III
832 Views

@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.

0 Kudos
Ron_Green
Moderator
821 Views

We have been working on constructors.  I'll take and look.

0 Kudos
TobiasK
Moderator
709 Views

Hi Wolf,


thank you for reporting this to us and for the clear and simple reproducer.

I have escalated the issue internally and will track the status for you.

(CMPLRLLVM-41963)


Best

Tobias



0 Kudos
TobiasK
Moderator
575 Views

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


0 Kudos
TobiasK
Moderator
481 Views

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


0 Kudos
Reply