<?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 Thank you people.  That makes in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172874#M146464</link>
    <description>&lt;P&gt;Thank you people.&amp;nbsp; That makes sense.&amp;nbsp; The parent and child types are in different modules.&amp;nbsp; I can see why the PRIVATE attribute can cause problems.&amp;nbsp; Glad I was able to isolate it without too much trouble, and fortunately we didn't use that pattern throughout our code.&amp;nbsp; Thanks again!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Dec 2017 22:06:24 GMT</pubDate>
    <dc:creator>clang001</dc:creator>
    <dc:date>2017-12-13T22:06:24Z</dc:date>
    <item>
      <title>Extended type objects not working properly with Intel Fortran 18</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172868#M146458</link>
      <description>&lt;P&gt;We have a large code base that works well with Intel 17.x and gfortran.&amp;nbsp; I recently upgraded to Intel 18 and all tests are now broken.&amp;nbsp; For some reason, methods on a polymorphic object are not not being called properly.&amp;nbsp; Instead of calling the method for an extended type, the program is calling the method for the parent type.&amp;nbsp; It would be some work to make a small example, so at this point and am trying to see if this bug has been detected.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 17:09:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172868#M146458</guid>
      <dc:creator>clang001</dc:creator>
      <dc:date>2017-12-13T17:09:38Z</dc:date>
    </item>
    <item>
      <title>@clang001,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172869#M146459</link>
      <description>&lt;P&gt;@clang001,&lt;/P&gt;

&lt;P&gt;A regression is always plausible (see threads such as &lt;A href="https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/752348#new)" target="_blank"&gt;https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/752348#new)&lt;/A&gt; but then there is also the possibility your extended types are relying on erroneous implementations of features introduced in Fortran starting with the 2003 standard which might have since been corrected in the compiler(s) to make them conform to the standard.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Good luck but note the chances are you will need a complete reproducer to get to the bottom of the problem.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 18:50:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172869#M146459</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2017-12-13T18:50:12Z</dc:date>
    </item>
    <item>
      <title>I seem to have found the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172870#M146460</link>
      <description>&lt;P&gt;I seem to have found the issue.&amp;nbsp; I think it is a bug in Intel Fortran 18, thought I can't be sure.&amp;nbsp; The following code is what I was using in a parent class (derived type with type-bound procedures).&amp;nbsp; I also had child classes (extended types) that overrode the read_int_array and read_dbl_array procedures.&amp;nbsp; They also had private tags.&amp;nbsp; &amp;nbsp;And this code has worked fine for a long time and with a variety of compilers.&amp;nbsp; Well it turns out the private tags were causing the problem with Intel Fortran 18.&amp;nbsp; With the private tags, the procedures were not overridden, and instead the parent class procedures were executed.&amp;nbsp; It could be that I was doing it wrong before, but it seems like a bug to me.&amp;nbsp; Thought I would post in case someone else runs into this.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Code that does not work on Intel Fortran 18:&lt;/P&gt;

&lt;PRE class="brush:fortran;" style="font-size: 13.008px;"&gt;    procedure, private :: read_int_array
    procedure, private :: read_dbl_array
    generic, public    :: read_grid_array =&amp;gt; read_int_array, read_dbl_array
&lt;/PRE&gt;

&lt;PRE class="brush:fortran;"&gt;
Fix is to remove private tags in parent and child classes

    procedure          :: read_int_array
    procedure          :: read_dbl_array
    generic, public    :: read_grid_array =&amp;gt; read_int_array, read_dbl_array
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 19:28:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172870#M146460</guid>
      <dc:creator>clang001</dc:creator>
      <dc:date>2017-12-13T19:28:42Z</dc:date>
    </item>
    <item>
      <title>We'd need to see a buildable</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172871#M146461</link>
      <description>&lt;P&gt;We'd need to see a buildable example to be sure, and please report this to the Intel Online Service Center.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 19:38:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172871#M146461</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2017-12-13T19:38:52Z</dc:date>
    </item>
    <item>
      <title>Are the parent and child</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172872#M146462</link>
      <description>&lt;P&gt;Are the parent and child types defined within the same module?&amp;nbsp; If they are in different modules, the child types cannot override the private bindings of the parent.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 19:53:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172872#M146462</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2017-12-13T19:53:46Z</dc:date>
    </item>
    <item>
      <title>The most likely explanation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172873#M146463</link>
      <description>&lt;P&gt;The most likely explanation is that you have run afoul of a change to the Fortran 2003 semantics that was introduced as a corrigendum to the standard. It significantly changed the behaviour of PRIVATE type-bound procedures. In effect, it prevents overriding a type-bound procedure outside the module that declares the type and its type-bound procedure.&lt;/P&gt;

&lt;P&gt;An attempt to do this effectively only adds a new type-bound procedure to the new type that can only be invoked if the declared type of the object is the extension type.&lt;/P&gt;

&lt;P&gt;Intel Fortran implemented this corrigendum to the standard with the 18.0 release. At some point I heard that a compiler option may exist to revert to the old (now non-conforming) behaviour but I wasn't able to find it.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;

&lt;P&gt;Reinhold&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 21:44:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172873#M146463</guid>
      <dc:creator>reinhold-bader</dc:creator>
      <dc:date>2017-12-13T21:44:30Z</dc:date>
    </item>
    <item>
      <title>Thank you people.  That makes</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172874#M146464</link>
      <description>&lt;P&gt;Thank you people.&amp;nbsp; That makes sense.&amp;nbsp; The parent and child types are in different modules.&amp;nbsp; I can see why the PRIVATE attribute can cause problems.&amp;nbsp; Glad I was able to isolate it without too much trouble, and fortunately we didn't use that pattern throughout our code.&amp;nbsp; Thanks again!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 22:06:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172874#M146464</guid>
      <dc:creator>clang001</dc:creator>
      <dc:date>2017-12-13T22:06:24Z</dc:date>
    </item>
    <item>
      <title>So I went ahead and mocked</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172875#M146465</link>
      <description>&lt;P&gt;So I went ahead and mocked something up to demonstrate this issue, and it does look like there is something wrong.&amp;nbsp; The program below produces:&lt;/P&gt;

&lt;P&gt;parent meth1; parent meth2; parent meth1; parent meth2&lt;/P&gt;

&lt;P&gt;which suggests that something is not right with the method overloading.&amp;nbsp; Clearly the second two print statements should read child meth1 and child meth2.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;When the private attributes are removed for both the parent and child procedures then the statements read ;&lt;/P&gt;

&lt;P&gt;parent meth1; parent meth2; child meth1; child meth2&lt;/P&gt;

&lt;P&gt;Hopefully I haven't done something obviously wrong here.&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module ParentModule
&amp;nbsp; implicit none
&amp;nbsp; type ParentType
&amp;nbsp; contains
&amp;nbsp;&amp;nbsp;&amp;nbsp; procedure, private :: meth1
&amp;nbsp;&amp;nbsp;&amp;nbsp; procedure, private :: meth2
&amp;nbsp;&amp;nbsp;&amp;nbsp; generic, public :: meth =&amp;gt; meth1, meth2
&amp;nbsp; end type ParentType
&amp;nbsp; contains
&amp;nbsp; subroutine meth1(this, i)
&amp;nbsp;&amp;nbsp;&amp;nbsp; class(ParentType) :: this
&amp;nbsp;&amp;nbsp;&amp;nbsp; integer, intent(in) :: i
&amp;nbsp;&amp;nbsp;&amp;nbsp; print *, 'parent meth1'
&amp;nbsp; end subroutine meth1
&amp;nbsp; subroutine meth2(this, d)
&amp;nbsp;&amp;nbsp;&amp;nbsp; class(ParentType) :: this
&amp;nbsp;&amp;nbsp;&amp;nbsp; double precision, intent(in) :: d
&amp;nbsp;&amp;nbsp;&amp;nbsp; print *, 'parent meth2'
&amp;nbsp; end subroutine meth2
end module ParentModule
&amp;nbsp; 
module ChildModule
&amp;nbsp; use ParentModule, only: ParentType
&amp;nbsp; implicit none
&amp;nbsp; type, extends(ParentType) :: ChildType
&amp;nbsp; contains
&amp;nbsp;&amp;nbsp;&amp;nbsp; procedure, private :: meth1
&amp;nbsp;&amp;nbsp;&amp;nbsp; procedure, private :: meth2&amp;nbsp; 
&amp;nbsp; end type ChildType
&amp;nbsp; contains
&amp;nbsp; subroutine meth1(this, i)
&amp;nbsp;&amp;nbsp;&amp;nbsp; class(ChildType) :: this
&amp;nbsp;&amp;nbsp;&amp;nbsp; integer, intent(in) :: i
&amp;nbsp;&amp;nbsp;&amp;nbsp; print *, 'child meth1'
&amp;nbsp; end subroutine meth1
&amp;nbsp; subroutine meth2(this, d)
&amp;nbsp;&amp;nbsp;&amp;nbsp; class(ChildType) :: this
&amp;nbsp;&amp;nbsp;&amp;nbsp; double precision, intent(in) :: d
&amp;nbsp;&amp;nbsp;&amp;nbsp; print *, 'child meth2'
&amp;nbsp; end subroutine meth2
end module ChildModule
&amp;nbsp; 
program test
&amp;nbsp; use ParentModule, only: ParentType
&amp;nbsp; use ChildModule, only: ChildType
&amp;nbsp; implicit none
&amp;nbsp; type(ParentType) :: p
&amp;nbsp; type(ChildType) :: c
&amp;nbsp; call p%meth(1)
&amp;nbsp; call p%meth(1.d0)
&amp;nbsp; call c%meth(1)
&amp;nbsp; call c%meth(1.d0)
&amp;nbsp; print*, 'done'
end
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 23:48:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172875#M146465</guid>
      <dc:creator>clang001</dc:creator>
      <dc:date>2017-12-13T23:48:12Z</dc:date>
    </item>
    <item>
      <title>Things are working as</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172876#M146466</link>
      <description>&lt;P&gt;Things are working as expected.&lt;/P&gt;

&lt;P&gt;The main program calls the generic binding `meth`, which is defined in the parent type, with specific bindings that are also in the parent type.&amp;nbsp; Those specific bindings are not overridden - the bindings of the same name in the child type are a separate pair, because the child type is being defined in a separate module and the original bindings in the parent type are private as discussed above.&amp;nbsp; Call the generic - get the specific bindings as defined in the parent type.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 06:04:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Extended-type-objects-not-working-properly-with-Intel-Fortran-18/m-p/1172876#M146466</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2017-12-14T06:04:21Z</dc:date>
    </item>
  </channel>
</rss>

