Bug 28154 - SPREAD (and friends) on unallocated arrays
SPREAD (and friends) on unallocated arrays
Status: NEW
Product: gcc
Classification: Unclassified
Component: fortran
4.2.0
: P3 enhancement
: ---
Assigned To: Not yet assigned to anyone
: diagnostic
Depends on:
Blocks: 37577
  Show dependency treegraph
 
Reported: 2006-06-24 19:13 UTC by Francois-Xavier Coudert
Modified: 2009-07-27 09:06 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-08-12 20:09:54


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2006-06-24 19:13:02 UTC
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.