<?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 I have posted complier error in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124952#M132586</link>
    <description>&lt;P&gt;I have posted complier error by 'Information for PARAMETER Constants' set to All.&lt;/P&gt;

&lt;P&gt;For this one, it doesn't matter.&lt;/P&gt;</description>
    <pubDate>Thu, 14 Sep 2017 07:52:25 GMT</pubDate>
    <dc:creator>An_N_1</dc:creator>
    <dc:date>2017-09-14T07:52:25Z</dc:date>
    <item>
      <title>parameters as actual argument cause stack overflow</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124950#M132584</link>
      <description>&lt;P&gt;My old project goes wrong with Intel® Parallel Studio XE 2017 Update 4 again.&lt;/P&gt;

&lt;P&gt;In sample code, subroutine foo crash on debug mode. (Stack overflow)&lt;/P&gt;

&lt;P&gt;If change integer :: a(N) to a(1000000), the code goes well.&lt;/P&gt;

&lt;P&gt;Similar things was happened with character parameter argument also.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;    program Console2

        call foo(1000000)
    
    end program Console2
    
    subroutine foo(N)

    implicit none
    
    integer :: N
    
        integer:: a(N)
    
    end subroutine&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 07:29:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124950#M132584</guid>
      <dc:creator>An_N_1</dc:creator>
      <dc:date>2017-09-14T07:29:26Z</dc:date>
    </item>
    <item>
      <title>Do you have the option for</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124951#M132585</link>
      <description>&lt;P&gt;Do you have the option for debugging parameters on? (/debug-parameters:used or all). This has been the cause for similar crashes for me. It has been discussed before in this forum.&lt;/P&gt;

&lt;P&gt;In Visual Studio the Debugging set of options&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 07:39:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124951#M132585</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2017-09-14T07:39:04Z</dc:date>
    </item>
    <item>
      <title>I have posted complier error</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124952#M132586</link>
      <description>&lt;P&gt;I have posted complier error by 'Information for PARAMETER Constants' set to All.&lt;/P&gt;

&lt;P&gt;For this one, it doesn't matter.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 07:52:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124952#M132586</guid>
      <dc:creator>An_N_1</dc:creator>
      <dc:date>2017-09-14T07:52:25Z</dc:date>
    </item>
    <item>
      <title>Oops, I should have mentioned</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124953#M132587</link>
      <description>&lt;P&gt;Oops, I should have mentioned that you should set the value to "none". You cannot inspect the parameters then, but a crash is not very helpful either.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 07:55:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124953#M132587</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2017-09-14T07:55:41Z</dc:date>
    </item>
    <item>
      <title>I mean , setting 'Information</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124954#M132588</link>
      <description>&lt;P&gt;I mean , setting '&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;Information for PARAMETER Constants'&amp;nbsp;&lt;/SPAN&gt;to none, doesn't help in this case.&lt;/P&gt;

&lt;P&gt;It will still crash.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 08:05:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124954#M132588</guid>
      <dc:creator>An_N_1</dc:creator>
      <dc:date>2017-09-14T08:05:30Z</dc:date>
    </item>
    <item>
      <title>Then, I am afraid, I have no</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124955#M132589</link>
      <description>&lt;P&gt;Then, I am afraid, I have no idea what is wrong.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 08:07:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124955#M132589</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2017-09-14T08:07:15Z</dc:date>
    </item>
    <item>
      <title>A local variable that is an</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124956#M132590</link>
      <description>&lt;P&gt;A local variable that is an array that has a size that depends on a dummy argument (which is a form of automatic variable in Fortran terminology) is often stored on the stack - as its size may vary each time the procedure is called.&lt;/P&gt;

&lt;P&gt;By default, the stack on Windows is only about one megabyte.&amp;nbsp; Your array requires about four megabytes.&amp;nbsp; Four megabytes does not fit in one megabyte.&lt;/P&gt;

&lt;P&gt;You either need to:&lt;/P&gt;

&lt;P&gt;- increase the stack size (in the Visual Studio properties for the executable, this is under Linker &amp;gt; System &amp;gt; Stack Reserve Size)&lt;/P&gt;

&lt;P&gt;- tell the compiler that temporary arrays should be stored on the heap (in Visual Studio this is under Fortran &amp;gt; Optimization &amp;gt; Heap Arrays, set it to zero).&lt;/P&gt;

&lt;P&gt;When you make the array size a constant, the compiler can set aside "static" storage for the array (i.e. not on the stack), as the storage required for the array is known at compile time.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 09:02:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124956#M132590</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2017-09-14T09:02:53Z</dc:date>
    </item>
    <item>
      <title>The error is because you</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124957#M132591</link>
      <description>&lt;P&gt;The error is because you overflowed the stack. If you take a zero off the N value there is no overflow. That said is seems wrong to me to be using an arg to dimension a local &amp;nbsp;array that is not an arg. It would make more sense to allocate that local using the passed arg and you would have it on the heap rather than the stack.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 09:14:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124957#M132591</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2017-09-14T09:14:30Z</dc:date>
    </item>
    <item>
      <title>Thanks IanH!</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124958#M132592</link>
      <description>&lt;P&gt;Thanks IanH!&lt;/P&gt;

&lt;P&gt;Both suggestions are helpful!&lt;/P&gt;

&lt;P&gt;I have modified&amp;nbsp;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;&amp;nbsp;Stack Commit Size, it doesn't work. So I didn't change reserve size option, and posted the question here.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;BTW, in older version of ivf, such as 2015/2012 i used before, setting stack commit size will aviod the stack overflow of the same code.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;I don't know why?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 09:38:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124958#M132592</guid>
      <dc:creator>An_N_1</dc:creator>
      <dc:date>2017-09-14T09:38:00Z</dc:date>
    </item>
    <item>
      <title>I am sorry, the question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124959#M132593</link>
      <description>&lt;P&gt;I am sorry, the question posted here is invalid.&lt;/P&gt;

&lt;P&gt;Increasing stack reseve size is OK. And increasing commit size is always useless in each version.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 01:21:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124959#M132593</guid>
      <dc:creator>An_N_1</dc:creator>
      <dc:date>2017-09-15T01:21:19Z</dc:date>
    </item>
    <item>
      <title>Rather than using the stack</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124960#M132594</link>
      <description>&lt;P&gt;Rather than using the stack for the "Automatic" array, you can use an ALLOCATE array, which will go on the heap, then not need selection of&amp;nbsp;any special compile options. This would be a more robust approach, eg:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;program Console2

&amp;nbsp;&amp;nbsp;&amp;nbsp; call foo(1000000)

end program Console2

subroutine foo(N)

&amp;nbsp; implicit none
&amp;nbsp; integer :: N

&amp;nbsp; integer, ALLOCATABLE :: a(:)

!&amp;nbsp; executable statements
&amp;nbsp; ALLOCATE ( A(N) )
&amp;nbsp;

end subroutine&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Note that ALLOCATE is an executable statement, not a declaration.&lt;BR /&gt;
	N can be much larger, say 100 million, or 1 billion in 64-bit environment.&lt;BR /&gt;
	You should review the documentation of ALLOCATE arrays, as they offer a number of advantages, but you need to consider the scope of the array.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 09:54:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/parameters-as-actual-argument-cause-stack-overflow/m-p/1124960#M132594</guid>
      <dc:creator>John_Campbell</dc:creator>
      <dc:date>2017-09-15T09:54:00Z</dc:date>
    </item>
  </channel>
</rss>

