In modern Fortran, the MOLD parameter of the ALLOCATE statement allows easily initializing an ALLOCATABLE array with the shape of anot
MOLD
ALLOCATE
ALLOCATABLE