title: Difference between local allocatable and automatic arrays
body: <p>I am interested in the difference between <code>alloc_array</code> and <code>automatic_array</code> in the following extract:</p>
  
  <pre><code>subroutine mysub(n)
  integer, intent(in)  :: n
  integer              :: automatic_array(n)
  integer, allocatable :: alloc_array(:)
  
  allocate(alloc_array(n))
  ...[code]...
  </code></pre>
  
  <p>I am familiar enough with the <strong>basics</strong> of allocation (not so much on advanced techniques) to know that allocation allows you to change the size of the array in the middle of the code (as pointed out in <a href="https://stackoverflow.com/questions/24337658/fortran-90-differences-in-declaring-allocatable-array">this question</a>), but I'm interested in considering the case where you don't <strong>need</strong> to change the size of the array; they might be passed onto other subroutines for operation, but the only purpose of both variables in the code and any subroutine is to hold the data of an array of dimension <code>n</code> (and maybe change the data, but not the size).</p>
  
  <p><strong>(1) Is there any difference in memory usage?</strong> I am not an expert in low level procedures, but I have a very slight knowledge of how they matter and how they can impact on the higher level programming (kind of experience I'm talkng about: once trying to run a big code in fortran I was getting a mistake I didn't understand, sysadmin told me "oh, yeah, you are probably saturating the stack; try adding this line in your running script"; anything that gives me insight into how to consider this things when actually coding and not having to patch them later is welcomed). I've been told by people that it might be dependent on many other things like compiler or architecture, but I interpreted from those responses that they were not completely sure of exactly how this was so. Is it so absolutely dependant on a multitude of factors or is there a default/intended behavior in the coding that may then be over-riden by optional compiling keywords or system preferences?</p>
  
  <p><strong>(2) Would the subroutines have different interface needs?</strong> Again, not an expert, but it had happened to me before that because of the way I declare variables of subroutine, I end up having to put the subroutines in a module. I've been given to understand this may vary depending on whether I use things that are special for allocatable variables. I am thinking about the case in which everything I do with the variables can be done both by allocatables and automatics, not intentionally using anything specific of allocatables (other than allocation before usage, that is).</p>
  
  <p><strong>Finally, in case this is of use:</strong> the reason I am asking is because we are developing in a group and we have recently noticed different people use those two declarations in different ways and we needed to determine if this is something that can be left to personal preference or if there might be any reasons why it might be a good idea to set a clear criteria (and how to set that criteria). I don't need extremely detailed answers, I am trying to determine if this is something I should be doing research about to be careful on how we use it and in what aspects of it should the research be directed.</p>
  
  <p>Though I would be interested to know of "interesting tricks" than can be done with allocation but are not directly related to the need of having size variability, I am leaving those for a possible future follow-up question and focusing here on the strictly functional differences (meaning: what I am explicitly telling compilers to do with my code). The two items I mentioned are the thing I could come up with due to previous experiences, but any other important one that I am missing and should consider, please do mention them.</p>