title: "Cannot assign to named constant" (reassigning a variable)
body: <p>I'm using a flag <code>f</code> for some error checking. Fortran (or maybe gfortran) won't let me reassign its value when I want to perform another check.</p>
  
  <pre><code>integer, dimension(:,:), allocatable :: A
  integer :: f, n        
  
  write (*, *) "Give an integer n &gt; 0. n = "
  
     read (*, IOSTAT=f) n
  
     do while(f /= 0)
        print *, "Error with input. Please try again."
        read (*, IOSTAT=f) n
     end do
  
     write (*, "(a, i5)") "You have entered n = ", n
  
     allocate(A(n), STAT=f)
     if (f /= 0) 
        print *, "Error: not enough memory for A."
     end if
  </code></pre>
  
  <p>NB: I think copy-pasting may mess up my spacing.</p>
  
  <p><code>f</code> has been declared as an integer (and not as a parameter integer): <code>integer :: f</code>.</p>
  
  <p>I'm very much a beginner with Fortran, so it's very possible I've made some unthinkable mistake!</p>