<?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 Even if this is not in the in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977935#M99005</link>
    <description>&lt;P&gt;Even if this is not in the standard, I think that for an extended type, allowing procedure pointers inside the derived type with the pass atribute, which were defined in the parent type, to point to procedures which have the extended type as dummy argument, (the situation in the first case), is convenient and makes no harm (I cannot think of a situation where this would lead to segmentation fault etc).&lt;/P&gt;
&lt;P&gt;I also think that allowing:&lt;/P&gt;
&lt;P&gt;procedure(type1interface), pointer :: pointer1&amp;nbsp;&lt;BR /&gt;procedure(type2interface), pointer :: pointer2&lt;/P&gt;
&lt;P&gt;pointer2 =&amp;gt; pointer1&lt;/P&gt;
&lt;P&gt;is convenient and makes no harm. So I would like to suggest this 2 features to be added to the compiler if you find it convenient.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Joan&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Mar 2013 08:54:08 GMT</pubDate>
    <dc:creator>jb84</dc:creator>
    <dc:date>2013-03-25T08:54:08Z</dc:date>
    <item>
      <title>Derived-type procedure pointer not able to point to subroutine with extended type as argument</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977931#M99001</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The following code compiles and works under the GNU fortran compiler. On the Intel compiler I get:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;error #8178: The procedure pointer and the procedure target must have matching arguments.&lt;BR /&gt; mytype%point1 =&amp;gt; type2subroutine&lt;/P&gt;
&lt;P&gt;Here is the code:&lt;/P&gt;
&lt;P&gt;module mod_type1&lt;BR /&gt; implicit none&lt;BR /&gt; &lt;BR /&gt; type :: type1&lt;BR /&gt; procedure(type1interface), pointer :: point1&lt;BR /&gt; end type&lt;BR /&gt; &lt;BR /&gt; interface&lt;BR /&gt; subroutine type1interface(a)&lt;BR /&gt; import type1&lt;BR /&gt; implicit none&lt;BR /&gt; class(type1) :: a&lt;BR /&gt; &lt;BR /&gt; end subroutine&lt;BR /&gt; end interface&lt;BR /&gt; &lt;BR /&gt; type, extends(type1) :: type2&lt;BR /&gt; end type&lt;BR /&gt; &lt;BR /&gt;contains&lt;BR /&gt; subroutine type2subroutine(a)&lt;BR /&gt; implicit none&lt;BR /&gt; class(type2) :: a&lt;BR /&gt; &lt;BR /&gt; write(*,*) 'hello pointer'&lt;BR /&gt; &lt;BR /&gt; end subroutine&lt;BR /&gt;end module&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;program Main&lt;BR /&gt; use mod_type1 &lt;BR /&gt; implicit none&lt;BR /&gt; &lt;BR /&gt; type(type2) :: mytype&lt;BR /&gt; &lt;BR /&gt; mytype%point1 =&amp;gt; type2subroutine&lt;BR /&gt; call mytype%point1&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;end program&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Should this work under the F2003 standard?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Joan&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2013 14:29:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977931#M99001</guid>
      <dc:creator>jb84</dc:creator>
      <dc:date>2013-03-22T14:29:22Z</dc:date>
    </item>
    <item>
      <title>No, this is not legal in</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977932#M99002</link>
      <description>&lt;P&gt;No, this is not legal in either F2003 or F2008. F2003 says:&lt;/P&gt;
&lt;P&gt;"If proc-pointer-object has an explicit interface, its characteristics shall be the same as proc-target except that proc-target may be pure even if proc-pointer-object is not pure and proc-target may be an elemental intrinsic procedure even if proc-pointer-object is not elemental." [F2003, p144, lines 39-41]&lt;/P&gt;
&lt;P&gt;F2008 has identical wording on p160, lines 6-8.&lt;/P&gt;
&lt;P&gt;Note that it says "characteristics shall be the same".&amp;nbsp; This is not like data pointer assignment where the requirement is only "type-compatible".&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2013 15:13:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977932#M99002</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2013-03-22T15:13:00Z</dc:date>
    </item>
    <item>
      <title>Here is a work-around which</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977933#M99003</link>
      <description>&lt;P&gt;Here is a work-around which works for both gnu and intel compilers, but i don't think it fulfills F2003 either, am I right?&lt;/P&gt;
&lt;P&gt;module mod_type1&lt;BR /&gt; implicit none&lt;BR /&gt; &lt;BR /&gt; private&lt;BR /&gt; public type1&lt;BR /&gt; &lt;BR /&gt; type :: type1&lt;BR /&gt; procedure(type1interface), pointer :: point1&lt;BR /&gt; &lt;BR /&gt;contains&lt;BR /&gt; procedure :: AssignProcedure&lt;/P&gt;
&lt;P&gt;end type&lt;BR /&gt; &lt;BR /&gt; interface&lt;BR /&gt; subroutine type1interface(a)&lt;BR /&gt; import type1&lt;BR /&gt; implicit none&lt;BR /&gt; class(type1) :: a&lt;BR /&gt; &lt;BR /&gt; end subroutine&lt;BR /&gt; end interface&lt;BR /&gt; &lt;BR /&gt;contains&lt;BR /&gt; &lt;BR /&gt; subroutine AssignProcedure(a,proc1,proc2) &lt;BR /&gt; implicit none&lt;BR /&gt; class(type1) :: a &lt;BR /&gt; procedure(type1interface), pointer :: proc2 &lt;BR /&gt; procedure(type1interface), pointer :: proc1&lt;/P&gt;
&lt;P&gt;proc1 =&amp;gt; proc2&lt;BR /&gt; &lt;BR /&gt; end subroutine&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;end module mod_type1&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;module mod_type2&lt;/P&gt;
&lt;P&gt;use mod_type1&lt;/P&gt;
&lt;P&gt;type, extends(type1) :: type2&lt;BR /&gt; procedure(type2interface), pointer :: point2&lt;BR /&gt; end type&lt;BR /&gt; &lt;BR /&gt; interface&lt;BR /&gt; subroutine type2interface(a)&lt;BR /&gt; import type2&lt;BR /&gt; implicit none&lt;BR /&gt; class(type2) :: a&lt;BR /&gt; &lt;BR /&gt; end subroutine&lt;BR /&gt; end interface&lt;BR /&gt; &lt;BR /&gt;contains&lt;BR /&gt; &lt;BR /&gt; subroutine type2subroutine(a)&lt;BR /&gt; implicit none&lt;BR /&gt; class(type2) :: a&lt;BR /&gt; &lt;BR /&gt; write(*,*) 'hello pointer'&lt;BR /&gt; &lt;BR /&gt; end subroutine&lt;BR /&gt; &lt;BR /&gt;end module&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;program Main&lt;BR /&gt; use mod_type1 &lt;BR /&gt; use mod_type2&lt;BR /&gt; implicit none&lt;BR /&gt; &lt;BR /&gt; type(type2) :: mytype&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; !mytype%point1 =&amp;gt; type2subroutine&lt;BR /&gt; mytype%point2 =&amp;gt; type2subroutine&lt;BR /&gt; &lt;BR /&gt; call mytype%AssignProcedure(mytype%point1,mytype%point2)&lt;BR /&gt; call mytype%point1&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;end program&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Joan&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2013 15:36:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977933#M99003</guid>
      <dc:creator>jb84</dc:creator>
      <dc:date>2013-03-22T15:36:44Z</dc:date>
    </item>
    <item>
      <title>I would argue that this is</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977934#M99004</link>
      <description>&lt;P&gt;I would argue that this is also not allowed by the standard, for much the same reason as the first case. The rule for "Actual arguments associated with dummy procedure entries" (F2008 12.5.2.9) has very similar wording to what I quoted above. saying "its characteristics as a procedure (12.3.1) shall be the same as those of its effective dummy argument...". If one turns to 12.3.1 it includes the type of the procedure's dummy arguments, which are not the same here (class(type1) and class(type2)).&lt;/P&gt;
&lt;P&gt;The program seems to work because type2subroutine doesn't use any components from the extended type, even though the pointer being called through is of the base type.&lt;/P&gt;
&lt;P&gt;I will pass this on to the developers and see if they have a contrary opinion. Realistically, I don't see how this variant can be valid if the direct pointer assignment is not. Issue ID is DPD200242410.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2013 16:35:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977934#M99004</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2013-03-22T16:35:00Z</dc:date>
    </item>
    <item>
      <title>Even if this is not in the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977935#M99005</link>
      <description>&lt;P&gt;Even if this is not in the standard, I think that for an extended type, allowing procedure pointers inside the derived type with the pass atribute, which were defined in the parent type, to point to procedures which have the extended type as dummy argument, (the situation in the first case), is convenient and makes no harm (I cannot think of a situation where this would lead to segmentation fault etc).&lt;/P&gt;
&lt;P&gt;I also think that allowing:&lt;/P&gt;
&lt;P&gt;procedure(type1interface), pointer :: pointer1&amp;nbsp;&lt;BR /&gt;procedure(type2interface), pointer :: pointer2&lt;/P&gt;
&lt;P&gt;pointer2 =&amp;gt; pointer1&lt;/P&gt;
&lt;P&gt;is convenient and makes no harm. So I would like to suggest this 2 features to be added to the compiler if you find it convenient.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Joan&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 08:54:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977935#M99005</guid>
      <dc:creator>jb84</dc:creator>
      <dc:date>2013-03-25T08:54:08Z</dc:date>
    </item>
    <item>
      <title>We don't typically extend the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977936#M99006</link>
      <description>&lt;P&gt;We don't typically extend the compiler in this sort of direction. I think there are cases where it could cause problems. I recommend sticking with standard-conforming code for portability and maintainability.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 20:14:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977936#M99006</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2013-03-25T20:14:17Z</dc:date>
    </item>
    <item>
      <title>Quote:jb84 wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977937#M99007</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;jb84 wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Even if this is not in the standard, I think that for an extended type, allowing procedure pointers inside the derived type with the pass atribute, which were defined in the parent type, to point to procedures which have the extended type as dummy argument, (the situation in the first case), is convenient and makes no harm (I cannot think of a situation where this would lead to segmentation fault etc).&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I've seen this sort of thing in some example code recently on &lt;A href="http://stackoverflow.com/questions/15576552/fortran-2003-procedure-pointer-concatenation"&gt;stack overflow&lt;/A&gt;, and this "proposal" was also recently put up on &lt;A href="http://fortranwiki.org/fortran/show/Polymorphism+for+procedure+pointers+inside+derived+types"&gt;the Fortran wiki&lt;/A&gt;. I presume this isn't a coincidence.&lt;/P&gt;
&lt;P&gt;Note that the above is not type safe - see the Fortran wiki for an explanation why.&lt;/P&gt;
&lt;P&gt;I think this may have come up because of the rules around passed arguments, specifically C456 requiring that the passed object be the declared type of the type being defined and not a parent type.&amp;nbsp; Philosophically, the passed argument is associated with &lt;STRONG&gt;the thing&lt;/STRONG&gt; that resulted in the procedure being invoked.&amp;nbsp; Note &lt;STRONG&gt;the thing&lt;/STRONG&gt; - not the thing's parent, or grandparent etc.&amp;nbsp; As far as I can tell this is only a philosophical point and not a technical requirement (i.e. I think the constraint could be relaxed with the language as it is now, but you'd want to think long and hard about the current situation and possible future language directions before you changed things - particularly around specific procedure resolution, etc).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, from that philosophical point - if you don't want the thing that resulted in the procedure being invoked being passed, then don't use a passed argument.&amp;nbsp; More philosophy - the "object%binding" and "object%proc-pointer-component" syntax is really all around either type based lookup or object based lookup of the procedure.&amp;nbsp; If you are not doing type based or object based lookup, then don't use that syntax.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 22:59:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977937#M99007</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2013-03-25T22:59:01Z</dc:date>
    </item>
    <item>
      <title>I see the problem now, thank</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977938#M99008</link>
      <description>&lt;P&gt;I see the problem now, thank you for the clarification.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 08:16:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-procedure-pointer-not-able-to-point-to-subroutine/m-p/977938#M99008</guid>
      <dc:creator>jb84</dc:creator>
      <dc:date>2013-03-26T08:16:20Z</dc:date>
    </item>
  </channel>
</rss>

