<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Internal compiler error - default initialization for nested derived types with arrays in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1329144#M158317</link>
    <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/194869"&gt;@Vincent4&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P class="sub_section_element_selectors"&gt;As you may know, an internal compiler error can be considered a compiler bug and as such, a compiler developer shall be keen to have it reported immediately in order to get the issue resolved.&lt;/P&gt;
&lt;P class="sub_section_element_selectors"&gt;If you have support subscription, please submit a request at Intel OSC:&amp;nbsp;&lt;A class="sub_section_element_selectors" href="https://supporttickets.intel.com/servicecenter?lang=en-US" target="_blank" rel="nofollow noopener noreferrer"&gt;https://supporttickets.intel.com/servicecenter?lang=en-US&lt;/A&gt;&lt;/P&gt;
&lt;P class="sub_section_element_selectors"&gt;Otherwise, you can hope Intel staff will pick up the incident from here.&lt;/P&gt;</description>
    <pubDate>Thu, 11 Nov 2021 16:24:06 GMT</pubDate>
    <dc:creator>FortranFan</dc:creator>
    <dc:date>2021-11-11T16:24:06Z</dc:date>
    <item>
      <title>Internal compiler error - default initialization for nested derived types with arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1328896#M158309</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;With the following code, ifort crashes with an internal compiler error:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;module object_module
  implicit none

  type :: object_inner
    integer :: tag = -1
  end type

  type :: object
    type(object_inner), dimension(2) :: inner = object_inner()
  contains
    procedure, pass, public :: get
  end type object

contains

  function get(this) result(num)
    implicit none
    class(object), intent(in) :: this
    integer :: num
    num = 0
  end function get

end module object_module

!--------------------------
! User module
module object_user
  use object_module
  implicit none

  type :: user
      !type(object) :: g = object(object_inner()) ! OK for both compilers
      type(object) :: g = object()               ! crashes ifort
  contains
    procedure, pass :: generate_crash
  end type user

contains

  subroutine generate_crash(this)
    implicit none
    class(user), intent(in) :: this
    integer :: dummy
    dummy = this % g % get()
  end subroutine generate_crash

end module object_user
!--------------------------&lt;/LI-CODE&gt;
&lt;P&gt;When trying to compile:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;gt; ifort --version
ifort (IFORT) 2021.4.0 20210910
Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.

&amp;gt; ifort -c ifort_crash.F90
ifort_crash.F90(44): catastrophic error: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report.  Note: File and line given may not be explicit cause of this error.
compilation aborted for ifort_crash.F90 (code 1)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;Line 32 of the code sample indicates a possible workaround, but that is not feasible if we want to keep "object_inner" private within the module. Is this even valid Fortran code?&lt;/P&gt;
&lt;P&gt;Let me know if this is not the right place to report such an error.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 20:35:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1328896#M158309</guid>
      <dc:creator>Vincent4</dc:creator>
      <dc:date>2021-11-10T20:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Internal compiler error - default initialization for nested derived types with arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1329144#M158317</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/194869"&gt;@Vincent4&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P class="sub_section_element_selectors"&gt;As you may know, an internal compiler error can be considered a compiler bug and as such, a compiler developer shall be keen to have it reported immediately in order to get the issue resolved.&lt;/P&gt;
&lt;P class="sub_section_element_selectors"&gt;If you have support subscription, please submit a request at Intel OSC:&amp;nbsp;&lt;A class="sub_section_element_selectors" href="https://supporttickets.intel.com/servicecenter?lang=en-US" target="_blank" rel="nofollow noopener noreferrer"&gt;https://supporttickets.intel.com/servicecenter?lang=en-US&lt;/A&gt;&lt;/P&gt;
&lt;P class="sub_section_element_selectors"&gt;Otherwise, you can hope Intel staff will pick up the incident from here.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 16:24:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1329144#M158317</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2021-11-11T16:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Internal compiler error - default initialization for nested derived types with arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1329150#M158318</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/194869"&gt;@Vincent4&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Not sure whether it will work with your actual code, but for the code you show in the original post, you don't need to default initialize the components of your derived types "object" and "user".&amp;nbsp; The ultimate component of both of these derived types end up being "tag" in your type "object_inner".&amp;nbsp; And "tag" is initialized.&amp;nbsp; Under the circumstances, the following is something you can consider:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;module object_module
  implicit none

  type :: object_inner
    integer :: tag = -1
  end type

  type :: object
    type(object_inner), dimension(2) :: inner !&amp;lt;-- inner%tag initialized
  contains
    procedure, pass, public :: get
  end type object

contains

  function get(this) result(num)
    implicit none
    class(object), intent(in) :: this
    integer :: num
    num = 0
  end function get

end module object_module

!--------------------------
! User module
module object_user
  use object_module
  implicit none

  type :: user
      type(object) :: g !&amp;lt;-- g%inner%tag initialized
  contains
    procedure, pass :: generate_crash
  end type user

contains

  subroutine generate_crash(this)
    implicit none
    class(user), intent(in) :: this
    integer :: dummy
    dummy = this % g % get()
  end subroutine generate_crash

end module object_user
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 11 Nov 2021 16:45:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1329150#M158318</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2021-11-11T16:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Internal compiler error - default initialization for nested derived types with arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1329521#M158334</link>
      <description>&lt;P&gt;Thank you for the suggestion &lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/92920"&gt;@FortranFan&lt;/a&gt; . Unfortunately. I need to initialize objects of type "user" from a pointer to uninitialized memory given by an external routine. Without the explicit default initialization of each component, code such as&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;u = user()&lt;/LI-CODE&gt;
&lt;P&gt;results in a compilation error with&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ifort_crash.F90(51): error #8212: Omitted component is not initialized. Component initialization missing:   [G]
      u = user()&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;Is there another way to initialize objects that I am unaware of? I'm wondering whether it's necessary to define a custom constructor for "user" and "object" (which is another way to work around this compilation issue).&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 15:52:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1329521#M158334</guid>
      <dc:creator>Vincent4</dc:creator>
      <dc:date>2021-11-12T15:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Internal compiler error - default initialization for nested derived types with arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1329525#M158335</link>
      <description>&lt;P&gt;Thank you for reporting this bug. I have escalated this to our compiler development for a fix. No, need to do anything else about this report.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 16:08:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1329525#M158335</guid>
      <dc:creator>Devorah_H_Intel</dc:creator>
      <dc:date>2021-11-12T16:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Internal compiler error - default initialization for nested derived types with arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1329757#M158353</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;@Vincent4 writes:
.. Without the explicit default initialization of each component, code such as

u = user()
results in a compilation error with

ifort_crash.F90(51): error #8212: Omitted component is not initialized. Component initialization missing:   [G]
      u = user()
 Is there another way to initialize objects that I am unaware of? I'm wondering whether it's necessary to define a custom constructor for "user" and "object" (which is another way to work around this compilation issue).&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/194869"&gt;@Vincent4&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Depending on how your "classes" (derived types in Fortran parlance) are designed, a "class" instance (usually just a variable in Fortran) does not need to "instantiated" with a constructor in order for its class "members" to have default values.&amp;nbsp; Type definition (and allocation in the case of variables with ALLOCATABLE attribute) does that for you.&amp;nbsp; Thus you do not need "u = user()" statements.&amp;nbsp; With the code I show upthread, "type(user) :: u" in a program unit will have "u" defined.&amp;nbsp; For example,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;   use object_user
   type(user) :: u
   print *, "u%g%inner%tag = ", u%g%inner%tag, "; expected is -1 -1"
end
&lt;/LI-CODE&gt;&lt;LI-CODE lang="none"&gt;C:\Temp&amp;gt;ifort /standard-semantics a.f90
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.3.0 Build 20210609_000000
Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.29.30038.1
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:a.exe
-subsystem:console
a.obj

C:\Temp&amp;gt;a.exe
 u%g%inner%tag =  -1 -1 ; expected is -1 -1&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But then if you somehow have a need to perform an assignment operation "u = user()" to "construct" your "class" instance of "u", you can consider a "custom" constructor.&amp;nbsp; Current Fortran standard allows a generic interface to have the same name as that of the derived type, so you can make use of that facility if that would help.&amp;nbsp; &lt;STRONG&gt;For example&lt;/STRONG&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;module object_user
  use object_module
  implicit none

  type :: user
      type(object) :: g !&amp;lt;-- g%inner%tag initialized
  contains
    procedure, pass :: generate_crash
  end type user

  generic :: user =&amp;gt; construct_user  !&amp;lt;-- generic interface with same name

contains

  function construct_user( tag ) result(r)
     integer, intent(in), optional :: tag
     type(user) :: r
     if ( present(tag) ) r%g%inner%tag = tag
  end function 

  subroutine generate_crash(this)
    implicit none
    class(user), intent(in) :: this
    integer :: dummy
    dummy = this % g % get()
  end subroutine generate_crash

end module object_user&lt;/LI-CODE&gt;&lt;LI-CODE lang="fortran"&gt;   use object_user
   type(user) :: u
   u = user( tag=42 ) !&amp;lt;-- retry with tag omitted.
   print *, "u%g%inner%tag = ", u%g%inner%tag, "; expected is 42 42"
end
&lt;/LI-CODE&gt;&lt;LI-CODE lang="none"&gt;C:\Temp&amp;gt;ifort /standard-semantics a.f90
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.3.0 Build 20210609_000000
Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.29.30038.1
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:a.exe
-subsystem:console
a.obj

C:\Temp&amp;gt;a.exe
 u%g%inner%tag =  42 42 ; expected is 42 42&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2021 15:28:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1329757#M158353</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2021-11-13T15:28:36Z</dc:date>
    </item>
    <item>
      <title>Re:Internal compiler error - default initialization for nested derived types with arrays</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1462985#M165450</link>
      <description>&lt;P&gt;This ICE (internal compiler error) is fixed in the current compiler release, 2021.8.0. Give it a try!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Mar 2023 22:56:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Internal-compiler-error-default-initialization-for-nested/m-p/1462985#M165450</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2023-03-07T22:56:50Z</dc:date>
    </item>
  </channel>
</rss>

