title: gfortran cannot read its own creation
body: <p>I am trying to compile a code with <code>gfortran</code>. One of the first things that happens in the compilation is the creation of <code>constants.mod</code>. Soon after that <code>gfortran</code> tells me: </p>
  
  <pre><code>Fatal Error: Cannot read module file ‘constants.mod’ opened at (1), because it was created by a different version of GNU Fortran
  </code></pre>
  
  <p>Now here's the thing: <em>This module file is created by the same <code>gfortran</code> that it's trying to read it.</em>  <code>gfortran</code> creates the thing itself and then 1 second later thinks the file was created by some other version!  Any idea what's going on here?</p>
  
  <p>You'll probably want to see the compile command:</p>
  
  <pre><code>mpif90 -c -O3 -ISDF/FORTRAN/include -I/usr/include -Iobj -Jobj -o obj/shared_data.o   src/core/shared_data.F90
  </code></pre>
  
  <p><code>shared_data.F90</code> contains the module <code>constants</code> at the top of the file.</p>
  
  <p>EDIT:  Here's the compile command followed by the full error message:</p>
  
  <pre><code>$&gt; mpif90 -c -O3 -ISDF/FORTRAN/include -I/usr/include -Iobj -Jobj -o obj/shared_data.o  src/core/shared_data.F90
  src/core/shared_data.F90:67:6:
  
     USE constants
        1
  Fatal Error: Cannot read module file ‘constants.mod’ opened at (1), because it was created by a different version of GNU Fortran
  compilation terminated.
  </code></pre>
  
  <p>UPDATE: I hope you'll agree this is weird.  The file that is failing is in <code>src/core</code>.  If I <code>cd</code> to <code>src/core</code> and issue this command:</p>
  
  <pre><code>mpif90 -c -O3 -I../../SDF/FORTRAN/include -I../../obj -J../../obj -o ../../obj/shared_data.o shared_data.F90
  </code></pre>
  
  <p>it compiles just fine! But then I clean everything out of the <code>obj</code> directory and I <code>cd</code> two levels up and issue:</p>
  
  <pre><code>mpif90 -c -O3 -ISDF/FORTRAN/include -Iobj -Jobj -o shared_data.o src/core/shared_data.F90
  </code></pre>
  
  <p>and it fails with the error I showed above!  What is the difference???  Thanks.</p>