<?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: Compiler bug:  target array can not be passed for pointer argument via generic interface in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327350#M158256</link>
    <description>&lt;P&gt;I'm inclined to agree with&amp;nbsp;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/156023"&gt;@Balint_Aradi&lt;/a&gt;&amp;nbsp;that the code should be accepted. Generic resolution isn't quite the same as argument association, but I think this cases passes the test. It's a fairly new thing in the language to allow passing a non-pointer to an INTENT(IN) pointer, and it's likely that the ifort developers overlooked adding a check for this in generic resolution.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Nov 2021 23:29:04 GMT</pubDate>
    <dc:creator>Steve_Lionel</dc:creator>
    <dc:date>2021-11-04T23:29:04Z</dc:date>
    <item>
      <title>Compiler bug:  target array can not be passed for pointer argument via generic interface</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327248#M158240</link>
      <description>&lt;P&gt;I have encountered a problem, when trying to pass an array with the target attribute as an actual argument to a procedure with a pointer, intent(in) dummy argument via a generic interface. The minimal working example below demonstrates the problem. Calling subptr_int1 directly works, but via the `subptr` interface does not, the compiler complains about not being to able to find a matching interface for the call.&amp;nbsp; Also, it seems, that for scalars it works&amp;nbsp; with the interface.&amp;nbsp; As far as I can judge, the code is standard conforming, two other compilers have no problems to compile it.&lt;/P&gt;
&lt;DIV style="color: #000000; background-color: #ffffff; font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'; font-weight: normal; font-size: 15px; line-height: 20px; white-space: pre;"&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt;module&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;test_target&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt;implicit&lt;/SPAN&gt; &lt;SPAN style="color: #267f99;"&gt;none&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt;interface&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;subptr&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt; module&lt;/SPAN&gt; &lt;SPAN style="color: #af00db;"&gt;procedure&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;subptr_int1&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt;end interface&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;subptr&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt;contains&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt; subroutine&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;subptr_int1&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;(val)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="color: #098658;"&gt; integer&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #af00db;"&gt;pointer&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #af00db;"&gt;intent&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;(in) :: val(:)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt; print&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; *, &lt;/SPAN&gt;&lt;SPAN style="color: #a31515;"&gt;"INTEGER1 PTR obtained"&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;, val(&lt;/SPAN&gt;&lt;SPAN style="color: #098658;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt; end subroutine&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;subptr_int1&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt;end module&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;test_target&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt;program&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;test_target_program&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt; use&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;test_target&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt; implicit&lt;/SPAN&gt; &lt;SPAN style="color: #267f99;"&gt;none&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN style="color: #098658;"&gt; integer&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #af00db;"&gt;target&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; :: int1val(&lt;/SPAN&gt;&lt;SPAN style="color: #098658;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN style="color: #000000;"&gt; int1val(&lt;/SPAN&gt;&lt;SPAN style="color: #098658;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;) = &lt;/SPAN&gt;&lt;SPAN style="color: #098658;"&gt;42&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="color: #af00db;"&gt; call&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;subptr&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;(int1val)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;P&gt;&lt;SPAN style="color: #af00db;"&gt;end program&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;test_target_program&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Nov 2021 17:19:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327248#M158240</guid>
      <dc:creator>Balint_Aradi</dc:creator>
      <dc:date>2021-11-04T17:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler bug:  target array can not be passed for pointer argument via generic interface</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327293#M158248</link>
      <description>&lt;P&gt;An array descriptor is not a pointer. Your subroutine requires a reference to a pointer be passed.&lt;/P&gt;
&lt;P&gt;Note, should you flip the arguments about (call with pointer to subroutine with array), the actual argument is that which the pointer points to and not the pointer itself.&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;module test_target
  implicit none
  interface subptr
    module procedure subptr_int1
  end interface subptr
contains
  subroutine subptr_int1(val)
    integer, pointer, intent(in) :: val(:)
    print *, "INTEGER1 PTR obtained", val(1)
  end subroutine subptr_int1
end module test_target

program test_target_program
 use test_target
 implicit none
 integer, target :: int1val(1)
 integer, pointer :: p(:)


 int1val(1) = 42
 p =&amp;gt; int1val
 call subptr(p)
end program test_target_program&lt;/LI-CODE&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 20:18:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327293#M158248</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2021-11-04T20:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler bug:  target array can not be passed for pointer argument via generic interface</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327301#M158249</link>
      <description>&lt;P&gt;The array in question (int1val) has the "target" attribute, therefore, according to the standard, it should be allowed to be an actual argument for a dummy argument with the 'pointer, intent(in)' argument. Consequently, the example above is correct and standard conforming.&lt;/P&gt;
&lt;P&gt;Note, that if I directly call the routine with "call subptr_int1(int1val)", the code compiles and works as supposed without any further changes.&amp;nbsp; It is only the generic interface, which confuses the Intel compiler. And, if I turn int1val and val into a scalar, the code again compiles and works without further changes. It is only the combination of using an array and the generic interface, where the compiler misbehaves.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 20:31:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327301#M158249</guid>
      <dc:creator>Balint_Aradi</dc:creator>
      <dc:date>2021-11-04T20:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler bug:  target array can not be passed for pointer argument via generic interface</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327350#M158256</link>
      <description>&lt;P&gt;I'm inclined to agree with&amp;nbsp;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/156023"&gt;@Balint_Aradi&lt;/a&gt;&amp;nbsp;that the code should be accepted. Generic resolution isn't quite the same as argument association, but I think this cases passes the test. It's a fairly new thing in the language to allow passing a non-pointer to an INTENT(IN) pointer, and it's likely that the ifort developers overlooked adding a check for this in generic resolution.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 23:29:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327350#M158256</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2021-11-04T23:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler bug:  target array can not be passed for pointer argument via generic interface</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327560#M158265</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt;&lt;SPAN&gt;I'm inclined to agree with&amp;nbsp;&lt;/SPAN&gt;&lt;A class="sub_section_element_selectors" href="https://community.intel.com/t5/user/viewprofilepage/user-id/156023" target="_blank"&gt;@BalintAradi&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;that the code should be accepted.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I disagree for this reason:&lt;/P&gt;
&lt;P&gt;The interface has been declared. In this specific example, then subroutine dummy argument for the pointer had intent(in) ...&lt;/P&gt;
&lt;P&gt;However, consider if the intent were instead intent(inout)&lt;/P&gt;
&lt;P&gt;In this case, had the call passed a pointer into the subroutine, the caller's pointer could be modified with =&amp;gt; as well as have the pointer's target altered with =.&lt;/P&gt;
&lt;P&gt;Orthogonality should not be broken dependent upon INTENT(IN) verses INTENT(INOUT) IMHO&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 13:38:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327560#M158265</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2021-11-05T13:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler bug:  target array can not be passed for pointer argument via generic interface</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327570#M158268</link>
      <description>&lt;P&gt;For whatever it's worth, I too think the program conforms and that Intel Fortran compiler should process the code ok.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 14:28:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327570#M158268</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2021-11-05T14:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler bug:  target array can not be passed for pointer argument via generic interface</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327580#M158270</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/63968"&gt;@jimdempseyatthecove&lt;/a&gt; I think, if a module procedure can be called directly with a given actual argument, one should be also able to call it with the same actual argument via the generic interface, if it is listed in that generic interface. The direct call works if the pointer dummy argument of the called subroutine is intent(in), and it does not work, if the pointer dummy argument is intent(inout) (as dictated by the standard). I'd expect the call via the generic interface to behave the same way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, as I mentioned above the posted example can be compiled and is working perfectly even with the Intel compiler if the dummy and the formal arguments are changed to scalars. So, I'd guess, the array case was just simply overseen.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 15:05:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327580#M158270</guid>
      <dc:creator>Balint_Aradi</dc:creator>
      <dc:date>2021-11-05T15:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler bug:  target array can not be passed for pointer argument via generic interface</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327598#M158272</link>
      <description>&lt;P&gt;Jim, the standard already carves out an exception for this case:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P class="1636127647219"&gt;If the dummy argument does not have INTENT (IN), the actual argument shall be a pointer. Otherwise, the&amp;nbsp;actual argument shall be a pointer or a valid target for the dummy pointer in a pointer assignment statement. If&amp;nbsp;the actual argument is not a pointer, the dummy pointer becomes pointer associated with the actual argument. (15.5.2.7p2)&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 05 Nov 2021 15:54:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327598#M158272</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2021-11-05T15:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler bug:  target array can not be passed for pointer argument via generic interface</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327616#M158274</link>
      <description>&lt;P&gt;If I read that correctly (correct me if I am wrong)...&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;If the dummy argument does not have INTENT (IN), the actual argument shall be a pointer.&amp;nbsp;" would apply to INTENT(OUT), INTENT(INOUT) and INTENT not specified.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The above is ambiguous (or maybe not). Is this a copy of the pointer of the caller or is this a reference to the caller's pointer?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My preference as to the decision made by the Fortran committee would be that this be a reference to the caller's pointer else how could you have a subroutine returning a pointer? Or, as an extension, a function returning a pointer?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jim Dempsey&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 16:36:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327616#M158274</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2021-11-05T16:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler bug:  target array can not be passed for pointer argument via generic interface</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327638#M158275</link>
      <description>&lt;P&gt;Yes, any INTENT not (IN), including unspecified, requires that the actual argument be a pointer if the dummy is a pointer. I don't think it is ambiguous.&lt;/P&gt;
&lt;P&gt;Subroutines don't "return" anything, and I don't see the connection with functions returning pointers. This feature allows you to pass a non-pointer to a pointer under conditions that disallow changes to the pointer (INTENT(IN)).&amp;nbsp; The dummy pointer becomes associated with the actual argument (rather than the target of a pointer actual argument).&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 17:59:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1327638#M158275</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2021-11-05T17:59:20Z</dc:date>
    </item>
    <item>
      <title>Re:Compiler bug:  target array can not be passed for pointer argument via generic interface</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1328212#M158298</link>
      <description>&lt;P&gt;I filed a bug report, CMPLRIL0-34402, and referenced this discussion.  Let's see what our Intel Fortran compiler developers have to say.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Nov 2021 20:45:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1328212#M158298</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2021-11-08T20:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler bug:  target array can not be passed for pointer argument via generic interface</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1413366#M162740</link>
      <description>&lt;P&gt;The fix will be available in the next oneAPI release.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 21:36:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-target-array-can-not-be-passed-for-pointer-argument/m-p/1413366#M162740</guid>
      <dc:creator>Devorah_H_Intel</dc:creator>
      <dc:date>2022-09-07T21:36:58Z</dc:date>
    </item>
  </channel>
</rss>

