title: Using array member as the control variable of do loop in fortran
body: <p>I was surprised that you cannot put a array member as the control variable of do loop like this:</p>
  
  <pre><code>program test
      integer, dimension(2) :: i 
  
      do i(1) = 1, 3
      do i(2) = 1, 3
          ! anything here
          write(*, *) i
      end do
      end do
  end program
  </code></pre>
  
  <p>My question is why it is not permitted?</p>
  
  <p><strong>Edit:</strong> 
  Or is it permitted but I am doing wrong?</p>
  
  <p>The error message from ifort v 11.1 is:</p>
  
  <pre><code>test.f90(4): error #5082: Syntax error, found IDENTIFIER 'I' when expecting one of: ( % : . = =&gt;
      do i(1) = 1, 3
  -------^
  test.f90(4): error #5082: Syntax error, found ',' when expecting one of: &lt;END-OF-STATEMENT&gt; ;
      do i(1) = 1, 3
  ---------------^
  test.f90(5): error #5082: Syntax error, found IDENTIFIER 'I' when expecting one of: ( % : . = =&gt;
      do i(2) = 1, 3
  -------^
  test.f90(5): error #5082: Syntax error, found ',' when expecting one of: &lt;END-OF-STATEMENT&gt; ;
      do i(2) = 1, 3
  ---------------^
  test.f90(4): error #6535: This variable or component must be of a derived or structure type   [DO]
      do i(1) = 1, 3
  ----^
  test.f90(4): error #6460: This is not a field name that is defined in the encompassing structure.   [I]
      do i(1) = 1, 3
  -------^
  test.f90(8): error #6099: An ENDDO statement occurred without a corresponding DO or DO WHILE statement.
      end do
  ----^
  test.f90(9): error #6099: An ENDDO statement occurred without a corresponding DO or DO WHILE statement.
      end do
  ----^
  </code></pre>
  
  <p>The error message from gfortran V4.5.1 &amp; 4.8.3 is:</p>
  
  <pre><code>test.f90:4.4:
  
      do i(1) = 1, 3
      1
  Error: Unclassifiable statement at (1)
  test.f90:5.4:
  
      do i(2) = 1, 3
      1
  Error: Unclassifiable statement at (1)
  test.f90:8.7:
  
      end do
         1
  Error: Expecting END PROGRAM statement at (1)
  test.f90:9.7:
  
      end do
         1
  Error: Expecting END PROGRAM statement at (1)
  </code></pre>