title: gfortran compile warning, "may be used uninitialized" for obviously initialized array
body: <p>My compiler has started giving me a warning on a part of my code I haven't touched while developing code...  The zarray is allocated, set to zero, then part of the array is set to rarray that is passed in.</p>
  <pre><code>SUBROUTINE advection(rbox0,rfrac,rarray,na)
    IMPLICIT NONE
  
    INTEGER,  INTENT(IN)   :: na
    REAL, INTENT(IN)   :: rfrac 
    REAL, INTENT(IN)   :: rbox0 
    REAL, INTENT(INOUT) :: rarray(0:na)
  
    ! local arrays
    REAL, ALLOCATABLE :: zarray1(:),zarray2(:)
  
  
    ALLOCATE(zarray1(-4:2*na))
    zarray1(:)=0.0
    zarray1(0:na)=rarray ! zarray stores the original array
    rarray(:)=0.0
    rarray(0)=(1.0-rbox0)*zarray1(0)
  
    ! etc etc 
  </code></pre>
  <p>Now with gfortran on a mac I'm getting this compile warning:</p>
  <pre><code>vectri.f90:1101:38:
  
   1101 |       rarray(0)=(1.0-rbox0)*zarray1(0)
        |                                      ^
  Warning: 'MEM &lt;real(kind=4)[0:]&gt; [(real(kind=4)[0:] *)_77][4]' may be used uninitialized [-Wmaybe-uninitialized]
  </code></pre>
  <p>In my experience, warnings such as these are ignored at your peril, but I can't for the life of me understand why the compiler is getting upset here... I'm using</p>
  <p>GNU Fortran (Homebrew GCC 11.3.0_1) 11.3.0</p>
  <p>EDIT: in reply to the comments below, the code was originally</p>
  <pre><code>zarray1=0.0
  </code></pre>
  <p>and</p>
  <pre><code>rarray=0.0
  </code></pre>
  <p>when the warning arose, I changed to insert <code>(:)</code> to see if it would help (it didn't :-( )</p>