This is not a bug (I don't think the code is legal), but surely we could do better than this:
$ cat zero_spread_2.f90 real,allocatable :: bar(:,:),foo(:) allocate(foo(0)) bar = spread(foo,dim=1,ncopies=1) print *, allocated(bar) end $ gfortran zero_spread_2.f90 && ./a.out T Same goes for most of the transformational intrinsics. libgfortran/intrinsic/spread_generic.c says: /* The front end has signalled that we need to populate the return array descriptor. */ We should really find another way of signaling this to the library (additional argument?) so that we can perform some checking. -- Summary: SPREAD (and friends) on unallocated arrays Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: diagnostic Severity: enhancement Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fxcoudert at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28154