title: gfortran for dummies: What does mcmodel=medium do exactly?
body: <p>I have some code that is giving me relocation errors when compiling, below is an example which illustrates the problem:</p>
  
  <pre><code>  program main
    common/baz/a,b,c
    real a,b,c
    b = 0.0
    call foo()
    print*, b
    end
  
    subroutine foo()
    common/baz/a,b,c
    real a,b,c
  
    integer, parameter :: nx = 450
    integer, parameter :: ny = 144
    integer, parameter :: nz = 144
    integer, parameter :: nf = 23*3
    real :: bar(nf,nx*ny*nz)
  
    !real, allocatable,dimension(:,:) :: bar
    !allocate(bar(nf,nx*ny*nz))
  
    bar = 1.0
    b = bar(12,32*138*42)
  
    return
    end
  </code></pre>
  
  <p>Compiling this with <code>gfortran -O3 -g -o test test.f</code>, I get the following error:</p>
  
  <pre><code>relocation truncated to fit: R_X86_64_PC32 against symbol `baz_' defined in COMMON section in /tmp/ccIkj6tt.o
  </code></pre>
  
  <p>But it works if I use <code>gfortran -O3 -mcmodel=medium -g -o test test.f</code>.  Also note that it works if I make the array allocatable and allocate it within the subroutine.</p>
  
  <p>My question is what exactly does <code>-mcmodel=medium</code> do?  I was under the impression that the two versions of the code (the one with <code>allocatable</code> arrays and the one without) were more or less equivalent ...</p>