<?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: Non-standard assignment with different derived types in constructor of derived type in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744226#M178670</link>
    <description>&lt;P&gt;I agree this is a bug. You don't even get a warning when standards checking is enabled.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Apr 2026 17:17:56 GMT</pubDate>
    <dc:creator>Steve_Lionel</dc:creator>
    <dc:date>2026-04-13T17:17:56Z</dc:date>
    <item>
      <title>Non-standard assignment with different derived types in constructor of derived type</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744132#M178665</link>
      <description>&lt;P&gt;We came across a compiler bug that misses to check the compatibility of derived types on initialization of members of a derived type using its constructor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;program SampleProg

  implicit none

  ! Type definitions
  type :: TA
    integer(4) :: value_
  end type

  type :: TB
    character(8) :: name_
  end type

  type :: THost
    type(TA) :: a_
  end type

  ! Variables
  type(THost) :: host

  ! This is the non-standard part:
  ! Why can an instance of TB get assigned to a member of type TA without compiler error?
  host = THost(a_ = TB('ABCDEFGH'))

  print *, "Host%a_%value_ interpreted as integer:", host%a_%value_
  
end program&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For line 23, the compiler shoud raise an error indicating that an instance of TB cannot be assigned to the member a_ which is of type TA.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We observed this behavior in Intel Fortran compiler even with standard semantics and all checks/warning turned on. Did we miss something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gfortran reports an error indicating that TA and TB are incompatible derived types which is the behavior we also have expected from Intel Fortran compiler.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2026 07:20:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744132#M178665</guid>
      <dc:creator>Oliver_Zick</dc:creator>
      <dc:date>2026-04-13T07:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Non-standard assignment with different derived types in constructor of derived type</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744166#M178666</link>
      <description>&lt;P&gt;Although it may seem unusual at first glance, I don't think that this storage of characters in an integer is all that unusual for Fortran compilers. It may fall under the heading of implicit type conversion. The characters can also, of course, be stored in a real number. It can be noted that the 8-character string would have been truncated as it is stored in a 4-byte integer. To store all 8 characters would require the use of an integer(8) or real(8) data type. This sort of behaviour is probably supported in order to maintain compatibility with older Fortran codes that made specific use of this feature.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2026 12:13:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744166#M178666</guid>
      <dc:creator>witwald</dc:creator>
      <dc:date>2026-04-13T12:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Non-standard assignment with different derived types in constructor of derived type</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744168#M178667</link>
      <description>&lt;P&gt;I can understand this and had the same idea. But on the other hand, it's confusing because you somehow expect a compiler error when you try to assign two incompatible derived types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In our case, it caused some issues because we had corrupted data and no one took notice of it because of - at least - a compiler hint that two incompatible derived types are assigned.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2026 12:20:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744168#M178667</guid>
      <dc:creator>Oliver_Zick</dc:creator>
      <dc:date>2026-04-13T12:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Non-standard assignment with different derived types in constructor of derived type</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744170#M178668</link>
      <description>&lt;P&gt;So when you do the same with local variables like in the example below, the compiler reports&amp;nbsp;error #6197: An assignment of different structure types is invalid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;program SampleProg

  implicit none

  ! Type definitions
  type :: TA
    integer(4) :: value_
  end type

  type :: TB
    character(8) :: name_
  end type
  
  type(TA):: a
  
  ! Properly handled by compiler indicating error #6197: An assignment of different structure types is invalid.
  a = TB('ABCDEFGH')

end program&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the behavior we expect also when doing the same assignment within a constructor call of a derived type.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2026 12:25:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744170#M178668</guid>
      <dc:creator>Oliver_Zick</dc:creator>
      <dc:date>2026-04-13T12:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Non-standard assignment with different derived types in constructor of derived type</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744226#M178670</link>
      <description>&lt;P&gt;I agree this is a bug. You don't even get a warning when standards checking is enabled.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2026 17:17:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744226#M178670</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2026-04-13T17:17:56Z</dc:date>
    </item>
    <item>
      <title>Re:Non-standard assignment with different derived types in constructor of derived type</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744325#M178676</link>
      <description>&lt;P&gt;It is a bug and I escalated it to be fixed (CMPLRLLVM-74900). Thank you for reporting it.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Apr 2026 14:16:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Non-standard-assignment-with-different-derived-types-in/m-p/1744325#M178676</guid>
      <dc:creator>Igor_V_Intel</dc:creator>
      <dc:date>2026-04-14T14:16:10Z</dc:date>
    </item>
  </channel>
</rss>

