<?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 Another question: Can I pass an unallocated array to a subroutine and allocate it in that program? in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Another-question-Can-I-pass-an-unallocated-array-to-a-subroutine/m-p/773657#M23875</link>
    <description>&lt;DIV&gt;Just like this:&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;integer, allocatable::test(:)&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;call allocatearray(test)&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;end&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;subroutine allocatearray(test)&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;integer, allocatable:: test(:)&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;if(allocated(test))deallocate(test)&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;allocate(test(100))&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;end subroutine&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;The program can be compiled and built, but when run it, it shows "Access Violation". How can I allocate an array in a subroutine (except for use a common module)?&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Thanks,&lt;/DIV&gt;
&lt;DIV&gt;Zhanghong, Tang&lt;/DIV&gt;</description>
    <pubDate>Tue, 13 Apr 2004 13:08:36 GMT</pubDate>
    <dc:creator>Zhanghong_T_</dc:creator>
    <dc:date>2004-04-13T13:08:36Z</dc:date>
    <item>
      <title>Another question: Can I pass an unallocated array to a subroutine and allocate it in that program?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Another-question-Can-I-pass-an-unallocated-array-to-a-subroutine/m-p/773657#M23875</link>
      <description>&lt;DIV&gt;Just like this:&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;integer, allocatable::test(:)&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;call allocatearray(test)&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;end&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;subroutine allocatearray(test)&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;integer, allocatable:: test(:)&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;if(allocated(test))deallocate(test)&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;allocate(test(100))&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;end subroutine&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;The program can be compiled and built, but when run it, it shows "Access Violation". How can I allocate an array in a subroutine (except for use a common module)?&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Thanks,&lt;/DIV&gt;
&lt;DIV&gt;Zhanghong, Tang&lt;/DIV&gt;</description>
      <pubDate>Tue, 13 Apr 2004 13:08:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Another-question-Can-I-pass-an-unallocated-array-to-a-subroutine/m-p/773657#M23875</guid>
      <dc:creator>Zhanghong_T_</dc:creator>
      <dc:date>2004-04-13T13:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: Another question: Can I pass an unallocated array to a subr</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Another-question-Can-I-pass-an-unallocated-array-to-a-subroutine/m-p/773658#M23876</link>
      <description>&lt;DIV&gt;This is supposed to work under Allocatable TR, implemented in CVF 6.5+ or IVF 8+. However, you&lt;/DIV&gt;
&lt;DIV&gt;have to have explicit interface of AllocateArray in the caller -- either put it in a MODULE (best) or write an interface block.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Jugoslav&lt;/DIV&gt;</description>
      <pubDate>Tue, 13 Apr 2004 19:29:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Another-question-Can-I-pass-an-unallocated-array-to-a-subroutine/m-p/773658#M23876</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2004-04-13T19:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Another question: Can I pass an unallocated array to a subr</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Another-question-Can-I-pass-an-unallocated-array-to-a-subroutine/m-p/773659#M23877</link>
      <description>&lt;DIV&gt;Thank you! &lt;/DIV&gt;
&lt;DIV&gt;Can I realize it without use module? How can I realize it by interface?&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Zhanghong, Tang&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Apr 2004 08:26:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Another-question-Can-I-pass-an-unallocated-array-to-a-subroutine/m-p/773659#M23877</guid>
      <dc:creator>Zhanghong_T_</dc:creator>
      <dc:date>2004-04-14T08:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Another question: Can I pass an unallocated array to a subr</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Another-question-Can-I-pass-an-unallocated-array-to-a-subroutine/m-p/773660#M23878</link>
      <description>&lt;DIV&gt;Just write an INTERFACE block in the caller containing prototype of the actual routine:&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;interface&lt;/DIV&gt;
&lt;DIV&gt; subroutine A(x)&lt;/DIV&gt;
&lt;DIV&gt; real, allocatable:: x(:)&lt;/DIV&gt;
&lt;DIV&gt; end subroutine A&lt;/DIV&gt;
&lt;DIV&gt;end interface&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Note that INTERFACE blocks are 1) clumsy and 2) error-prone, because if you e.g. add an argument to A, you have to rewrite all INTERFACE blocks as well or you will get strange run-time errors. Ideally, they should be used only when interfacing with routines written in other language (or for "cheating" purposes, as in my other post). &lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Jugoslav&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Apr 2004 22:47:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Another-question-Can-I-pass-an-unallocated-array-to-a-subroutine/m-p/773660#M23878</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2004-04-14T22:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Another question: Can I pass an unallocated array to a subr</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Another-question-Can-I-pass-an-unallocated-array-to-a-subroutine/m-p/773661#M23879</link>
      <description>&lt;DIV&gt;Thank you again! This is what I want!&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Zhanghong, Tang&lt;/DIV&gt;</description>
      <pubDate>Thu, 15 Apr 2004 07:53:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Another-question-Can-I-pass-an-unallocated-array-to-a-subroutine/m-p/773661#M23879</guid>
      <dc:creator>Zhanghong_T_</dc:creator>
      <dc:date>2004-04-15T07:53:59Z</dc:date>
    </item>
  </channel>
</rss>

