title: Compiler difference between gfortran and ifort (allocatable arrays and global variables)
body: <h2>The Code</h2>
  
  <p>The following MWE describes what I want to use (note that I did not design this, I am merely trying to use someones code, I would not usually use global variables).</p>
  
  <pre><code>PROGRAM MAIN
  IMPLICIT NONE
  
    integer :: N
    real(8), allocatable :: a(:,:)
  
    N=3
    allocate(a(N,3))
  
    a=initialize_array()
  
    CONTAINS
      function initialize_array() result(a)
      IMPLICIT NONE
          real(8) :: a(N,3)
          a=1
      end function initialize_array  
  
  END PROGRAM MAIN
  </code></pre>
  
  <h2>The Problem</h2>
  
  <p>gfortran gives an error which reads <code>Error: Variable 'n' cannot appear in the expression at (1)</code>, pointing to to the <code>real(8) :: a(N,3)</code> inside the function.
  In a subroutine it would work, so what might be the problem here?</p>
  
  <h2>The question</h2>
  
  <p>Why does ifort (v. 15.0.3) compile this, while gfortran (v. 4.8.4) does not?</p>