<?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: Re:Wrong code (missing temporary) passing array section to explicit size dummy in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1464333#M165490</link>
    <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/44501"&gt;@Barbara_P_Intel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;It is not convincing this is a run-time issue only.&amp;nbsp; The evidence is this is a combination issue with the compile-time actions toward the handling of unlimited polymorphic type with the explicit shape received argument.&amp;nbsp; Because if you try with an integer type as opposed to unlimited polymorphic, you will see the program response is as expected by OP:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;module m
contains
   subroutine s(a, n)
      integer, intent(in) :: n
      integer, intent(in) :: a(n)
      print *,'a is integer, a=', a
   end
end&lt;/LI-CODE&gt;
&lt;P&gt;You many want to review this with the Intel Fortran team.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Mar 2023 18:39:45 GMT</pubDate>
    <dc:creator>FortranFan</dc:creator>
    <dc:date>2023-03-10T18:39:45Z</dc:date>
    <item>
      <title>Wrong code (missing temporary) passing array section to explicit size dummy</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1462948#M165446</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;the following code prints wrong results in the called subroutine:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;module m
  implicit none
contains
  subroutine s(a, n)
    integer,  intent(in) :: n
    class(*), intent(in) :: a(n)

    select type(a)
    type is(integer)
       print *,'a is integer, a=', a
    class default
       print *,'a is unsupported type'
       stop 1
    end select
  end
end

program p
  use m
  implicit none
  integer :: b(2,2) = reshape([21, 22, 23, 24], [2,2])

  print *,b
  call s (b,4) ! OK
  print *
  print *,b(:,1::2)
  call s (b(:,1::2),2) ! OK
  print *
  print *,b(1::2,:)
  call s (b(1::2,:),2) ! bad
  print *
  print *,b(2::2,:)
  call s (b(2::2,:),2) ! bad
end
&lt;/LI-CODE&gt;
&lt;P&gt;I get with current ifort:&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;          21          22          23          24
 a is integer, a=          21          22          23          24
 
          21          22
 a is integer, a=          21          22
 
          21          23
 a is integer, a=          21          22
 
          22          24
 a is integer, a=          22          23
&lt;/LI-CODE&gt;
&lt;P&gt;So while the first two cases are ok, the last two are not.&amp;nbsp; Maybe there is no temporary generated for the passed array section to the explicit size dummy, and the actual stride of dimension 1 is not unity.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Harald&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 21:40:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1462948#M165446</guid>
      <dc:creator>Harald1</dc:creator>
      <dc:date>2023-03-07T21:40:25Z</dc:date>
    </item>
    <item>
      <title>Re:Wrong code (missing temporary) passing array section to explicit size dummy</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1463456#M165463</link>
      <description>&lt;P&gt;Thank you! Love these nice reproducers! &lt;/P&gt;&lt;P&gt;I'll check this out.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Mar 2023 22:18:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1463456#M165463</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2023-03-08T22:18:18Z</dc:date>
    </item>
    <item>
      <title>Re:Wrong code (missing temporary) passing array section to explicit size dummy</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1463783#M165467</link>
      <description>&lt;P&gt;I filed a bug, CMPLRLLVM-45596. This reproducer gets the same wrong results with ifx.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Mar 2023 16:40:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1463783#M165467</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2023-03-09T16:40:43Z</dc:date>
    </item>
    <item>
      <title>Re:Wrong code (missing temporary) passing array section to explicit size dummy</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1463811#M165469</link>
      <description>&lt;P&gt;UPDATE... the compiler should actually print an error message. &lt;/P&gt;&lt;P&gt;Intel's resident Fortran standards guru told me:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The problem with the test case is that they are passing a two dimensional array section to a one dimensional explicit shape array.&amp;nbsp;This is wrong because 1) passing an array section requires the dummy argument be assumed shape or deferred shape (bounds are declared with colons), and 2) because they are passing a two dimensional array to a one dimensional array and the interface is explicit.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If at line 6, the dimensions of a are declared as “a(:, :)”, it compiles fine an produces the output.&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Mar 2023 17:56:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1463811#M165469</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2023-03-09T17:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong code (missing temporary) passing array section to explicit size dummy</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1463824#M165470</link>
      <description>&lt;P&gt;Would the resident Fortran standard guru please explain this?&lt;/P&gt;
&lt;P&gt;For dummy arguments of intrisinc types, this works by F2018: 15.5.2.11 Sequence association.&amp;nbsp; I do not see a reason for this to not apply here, so any helpful pointer is appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 18:28:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1463824#M165470</guid>
      <dc:creator>Harald1</dc:creator>
      <dc:date>2023-03-09T18:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong code (missing temporary) passing array section to explicit size dummy</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1463833#M165472</link>
      <description>&lt;P&gt;Here's an extended version that allows comparison of intrinsic type dummy and class(*) dummy:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;module m
  implicit none
contains
  subroutine s(a, n)
    integer,  intent(in) :: n
    class(*), intent(in) :: a(n)

    select type(a)
    type is(integer)
       print *,'a is integer, a=', a
    class default
       print *,'a is unsupported type'
       stop 1
    end select
  end
  subroutine t(a, n)
    integer, intent(in) :: n
    integer, intent(in) :: a(n)
    print *,'subroutine t: a=', a
  end
end

program p
  use m
  implicit none
  integer :: b(2,2) = reshape([21, 22, 23, 24], [2,2])

  print *,b
  call s (b,4) ! OK
  call t (b,4) ! OK
  print *
  print *,b(:,1::2)
  call s (b(:,1::2),2) ! OK
  call t (b(:,1::2),2) ! OK
  print *
  print *,b(1::2,:)
  call s (b(1::2,:),2) ! bad
  call t (b(1::2,:),2) ! OK
  print *
  print *,b(2::2,:)
  call s (b(2::2,:),2) ! bad
  call t (b(2::2,:),2) ! OK
  print *
  print *, "With an explicit temporary:"
  call s ((b(2::2,:)),2) ! this is now OK!
  call t ((b(2::2,:)),2) ! also OK
end
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So for the subroutine t with a dummy with explicit-shape array of type integer I get what I expect.&amp;nbsp; With class(*) I'd need an explicit temporary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 19:04:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1463833#M165472</guid>
      <dc:creator>Harald1</dc:creator>
      <dc:date>2023-03-09T19:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong code (missing temporary) passing array section to explicit size dummy</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1464254#M165487</link>
      <description>&lt;P&gt;I'm afraid that I'm on Harald's side here - there is no requirement that the dummy argument be assumed-shape. Sequence association does apply.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;F2018 15.5.2.4&lt;/P&gt;
&lt;P&gt;p18&amp;nbsp;Except when a procedure reference is elemental (15.8), each element of an array actual argument or of a sequence&amp;nbsp;in a sequence association (15.5.2.11) is associated with the element of the dummy array that has the same position&amp;nbsp;in array element order (9.5.3.2).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The compiler would have to do copy-in (and copy-out if not INTENT(IN) or a vector subscript.)&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 16:46:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1464254#M165487</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2023-03-10T16:46:00Z</dc:date>
    </item>
    <item>
      <title>Re:Wrong code (missing temporary) passing array section to explicit size dummy</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1464262#M165488</link>
      <description>&lt;P&gt;After more research and discussion behind the scenes, the Fortran gurus determined that the original reproducer is valid code and Intel Fortran has a bug. Bug is filed as a runtime issue.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 10 Mar 2023 15:54:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1464262#M165488</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2023-03-10T15:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Re:Wrong code (missing temporary) passing array section to explicit size dummy</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1464333#M165490</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/44501"&gt;@Barbara_P_Intel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;It is not convincing this is a run-time issue only.&amp;nbsp; The evidence is this is a combination issue with the compile-time actions toward the handling of unlimited polymorphic type with the explicit shape received argument.&amp;nbsp; Because if you try with an integer type as opposed to unlimited polymorphic, you will see the program response is as expected by OP:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;module m
contains
   subroutine s(a, n)
      integer, intent(in) :: n
      integer, intent(in) :: a(n)
      print *,'a is integer, a=', a
   end
end&lt;/LI-CODE&gt;
&lt;P&gt;You many want to review this with the Intel Fortran team.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 18:39:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1464333#M165490</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2023-03-10T18:39:45Z</dc:date>
    </item>
    <item>
      <title>Re:Wrong code (missing temporary) passing array section to explicit size dummy</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1464360#M165492</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/92920"&gt;@FortranFan&lt;/a&gt;, when I said "runtime issue" I meant that the compiler need not print an error message since the code is legal Fortran. &lt;/P&gt;&lt;P&gt;The compiler is indeed generating bad code for this case. That's the bug.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 10 Mar 2023 19:57:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1464360#M165492</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2023-03-10T19:57:42Z</dc:date>
    </item>
    <item>
      <title>Re:Wrong code (missing temporary) passing array section to explicit size dummy</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1546229#M169326</link>
      <description>&lt;P&gt;With the release of 2024.0, both ifx and ifort are printing the correct answers at runtime.&lt;/P&gt;&lt;P&gt;Please check out the new releases.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 21 Nov 2023 20:30:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1546229#M169326</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2023-11-21T20:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong code (missing temporary) passing array section to explicit size dummy</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1546621#M169359</link>
      <description>&lt;P&gt;The testcase is fixed, indeed!&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 21:20:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Wrong-code-missing-temporary-passing-array-section-to-explicit/m-p/1546621#M169359</guid>
      <dc:creator>Harald1</dc:creator>
      <dc:date>2023-11-22T21:20:59Z</dc:date>
    </item>
  </channel>
</rss>

