title: READ statement doesn't read last number from file
body: <p>Suppose you have this program</p>
  
  <ol>
  <li>Subroutine <code>readDIM</code> which reads the dimensions (rows, columns) of a matrix from a txt file. (In order to simplify, let it be an INTEGER). <code>ReadDIM</code> works using tokens and it works fine by assumption.</li>
  </ol>
  
  <p>A text file containing for example: </p>
  
  <pre><code>1 2 3 4
  1 2 20 5
  3 0 333 3
  </code></pre>
  
  <p>Returns <code>nrow = 3, ncol = 4</code></p>
  
  <ol start="2">
  <li><p>Since <code>readDIM</code> has given the true dimensions of the matrix, I want to allocate space to:  </p>
  
  <pre><code>REAL, DIMENSION (:,:), ALLOCATABLE :: vMatrix
  </code></pre></li>
  </ol>
  
  <p>To read the matrix from a txt file and to store it into the 2d-array. So I've written the following </p>
  
  <pre><code>SUBROUTINE buildVMatrix     
     OPEN(UNIT=1, FILE = filename, STATUS ='OLD',IOSTAT=ios);
     ALLOCATE(vMatrix(nrow,ncol));
     WRITE(*,*) "Register matrix from file:", filename;
     WRITE(*,*) "-------------------------------------------------------";
     DO i = 1, UBOUND(vMatrix,1)
        READ(1,*, IOSTAT = ios) (vMatrix(i,j),j=1,UBOUND(vMatrix,2));
        !IF(ios /= 0 ) EXIT 
     END DO
     CLOSE(1)
  END SUBROUTINE 
  </code></pre>
  
  <p>When I print <code>vMatrix</code> the output is:</p>
  
  <pre><code>matrix.txt   : 1 2 3 4            buildVMatrix output (once printed) 1 2 3 4
                 1 2 20 5                                              1 2 20 5    
                 3 0 333 3                                             3 0 333 0
  </code></pre>
  
  <p>It doesn't read the last number. I know it's caused by the <code>DO</code> loop inside <code>buildVMatrix</code>, but can't explain myself this and have no idea how to fix it writing a different code.</p>