<?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 Array rank checking in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762129#M17616</link>
    <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
an exemple :&lt;BR /&gt;
&lt;BR /&gt;
&lt;PRE&gt;
program t

real*8, allocatable :: tab1(:)
real*8, pointer     :: tab2(:)
real*8              :: tab3(2)

allocate(tab1(2),tab2(2))

tab1 = 0.D0 ; tab2 = 0.D0 ; tab3 = 0.D0

call test(tab1)
call test(tab2)
call test(tab3)

contains
subroutine test(tab)
real*8 tab(2,2)

print*,tab

end subroutine test
end program t
&lt;/PRE&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The compilation gives the following error :&lt;BR /&gt;
&lt;BR /&gt;
ifort -warn all test3.f90&lt;BR /&gt;
fortcom: Error: test3.f90, line 11: The shape matching rules of actual arguments and dummy arguments have been violated.   [TAB3]&lt;BR /&gt;
call test(tab3)&lt;BR /&gt;
----------^&lt;BR /&gt;
compilation aborted for test3.f90 (code 1)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
My question is why allocated arrays do not generate the errors I was waiting for ??&lt;P&gt;Message Edited by sblionel on &lt;SPAN class="date_text"&gt;09-15-2005&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;12:44 PM&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Sep 2005 23:32:38 GMT</pubDate>
    <dc:creator>tonio</dc:creator>
    <dc:date>2005-09-15T23:32:38Z</dc:date>
    <item>
      <title>Array rank checking</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762129#M17616</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
an exemple :&lt;BR /&gt;
&lt;BR /&gt;
&lt;PRE&gt;
program t

real*8, allocatable :: tab1(:)
real*8, pointer     :: tab2(:)
real*8              :: tab3(2)

allocate(tab1(2),tab2(2))

tab1 = 0.D0 ; tab2 = 0.D0 ; tab3 = 0.D0

call test(tab1)
call test(tab2)
call test(tab3)

contains
subroutine test(tab)
real*8 tab(2,2)

print*,tab

end subroutine test
end program t
&lt;/PRE&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The compilation gives the following error :&lt;BR /&gt;
&lt;BR /&gt;
ifort -warn all test3.f90&lt;BR /&gt;
fortcom: Error: test3.f90, line 11: The shape matching rules of actual arguments and dummy arguments have been violated.   [TAB3]&lt;BR /&gt;
call test(tab3)&lt;BR /&gt;
----------^&lt;BR /&gt;
compilation aborted for test3.f90 (code 1)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
My question is why allocated arrays do not generate the errors I was waiting for ??&lt;P&gt;Message Edited by sblionel on &lt;SPAN class="date_text"&gt;09-15-2005&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;12:44 PM&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2005 23:32:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762129#M17616</guid>
      <dc:creator>tonio</dc:creator>
      <dc:date>2005-09-15T23:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Array rank checking</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762130#M17617</link>
      <description>ifort does not do run-time shape checking in the current version.  It is something we hope to implement in the future. But I agree that the compiler, at compile time, should be able to notice that the ranks don't match.  I'll suggest that to the developers.</description>
      <pubDate>Thu, 15 Sep 2005 23:47:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762130#M17617</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2005-09-15T23:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Array rank checking</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762131#M17618</link>
      <description>Thanks Steve.&lt;BR /&gt;&lt;BR /&gt;I trusted too much the compiler for this and lost hours looking for the bug :-/</description>
      <pubDate>Thu, 15 Sep 2005 23:51:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762131#M17618</guid>
      <dc:creator>tonio</dc:creator>
      <dc:date>2005-09-15T23:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Array rank checking</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762132#M17619</link>
      <description>Sorry to be confusing here - but on further research, the standard explicitly permits the rank to be different.  Here is what the standard says:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;18 An actual argument that represents an element sequence and corresponds to a dummy argument that is&lt;BR /&gt;19 an array is sequence associated with the dummy argument if the dummy argument is an explicit-shape&lt;BR /&gt;20 or assumed-size array. The rank and shape of the actual argument need not agree with the rank and&lt;BR /&gt;21 shape of the dummy argument, but the number of elements in the dummy argument shall not exceed&lt;BR /&gt;22 the number of elements in the element sequence of the actual argument. If the dummy argument is&lt;BR /&gt;23 assumed-size, the number of elements in the dummy argument is exactly the number of elements in the&lt;BR /&gt;24 element sequence.&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;In a more recent version of the compiler than the one you are using, the compiler would note that array tab3 had fewer elements than dummy argument tab and would give you a (different from what you saw) warning about that, but it has no way of knowing how many elements are in the allocatable arrays so it can't check.</description>
      <pubDate>Fri, 16 Sep 2005 00:19:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762132#M17619</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2005-09-16T00:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Array rank checking</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762133#M17620</link>
      <description>Even if the standard permits this "trap" to occur, the compiler could at least give a warning !</description>
      <pubDate>Fri, 16 Sep 2005 14:52:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762133#M17620</guid>
      <dc:creator>tonio</dc:creator>
      <dc:date>2005-09-16T14:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Array rank checking</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762134#M17621</link>
      <description>No, we don't give warnings for standard-conforming behavior, and in fact there are many legitimate uses for this.&lt;BR /&gt;&lt;BR /&gt;What we could do is add an optional run-time check that the array you're passing is at least as big as the declared size of the routine dummy argument, but that may or may not help you depending on what your error was.</description>
      <pubDate>Fri, 16 Sep 2005 20:29:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Array-rank-checking/m-p/762134#M17621</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2005-09-16T20:29:43Z</dc:date>
    </item>
  </channel>
</rss>

