title: Variable size arrays in Fortran without Allocate()
body: <p>Is there a way to create variable size arrays in Fortran <strong>on the stack</strong>? Allocate() does not work for me, because it places the array on the heap. This may lead to problems with parallelization (see my other question:
  <a href="https://stackoverflow.com/questions/6605677/openmp-poor-performance-of-heap-arrays-stack-arrays-work-fine/">OpenMP: poor performance of heap arrays (stack arrays work fine)</a> ). Of course, some smart memory management would give a way around that problem, but memory management in Fortran sounds silly.</p>
  
  <p>Essentially, I am looking for a Fortran equivalent of the following in C:</p>
  
  <pre><code>scanf("%d", N);
  int myarray[N];
  </code></pre>
  
  <p>To re-iterate: I do NOT want</p>
  
  <pre><code>Integer, PARAMETER :: N=100
  Integer, Dimension(N) :: myarray
  </code></pre>
  
  <p>because this determines the array size at compile time. Neither do I want</p>
  
  <pre><code>Integer, Dimension(:), Allocatable :: myarray
  read(*,*) N
  Allocate(myarray(1:N))
  </code></pre>
  
  <p>because it places the array on the heap. </p>
  
  <p>Help very much appreciated. I was very happy with Allocatable arrays until my recent encounter with the problem in the question cited above. If there is a negative answer to this question, I would very much appreciate a link to the source. </p>
  
  <p>Edit: see comments to M.S.B.'s answer. An elegant way of doing this only became possible in Fortran 2008, and it is done in a <code>block</code> construct.</p>