anchor.diff:           call sw_error('sw_misfit_ecs: Output array for dt_ecs is too small')
      endif
   
  -   call sw_alloc(phi2,n)
  -   call sw_alloc(dt2,n)
  +   allocate(phi2(n), dt2(n))
   
      ! Calculate splitting and misfit for each observation
      do i=1,n
  
positive.code:       call random_number(random_noise)
        random_noise = (random_noise*2.0 - 1.0) * noise_in
        Z%trace = Z%trace + random_noise
     endif
  
     ! Add analysis window picks
  
negative.code:          real(dt2(i),r4), real(spol(i),r4), freq=real(freq_in,r4), &
           delta=real(delta_in,r4), noise=real(noise_in,r4), wavetype=wavetype_in)
     enddo
  
     deallocate(phi2, dt2)
  
  end subroutine sw_misfit_ecs
  !-------------------------------------------------------------------------------
  