This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/28154] SPREAD (and friends) on unallocated arrays
- From: "quantheory at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 03 Dec 2014 04:32:22 +0000
- Subject: [Bug fortran/28154] SPREAD (and friends) on unallocated arrays
- Auto-submitted: auto-generated
- References: <bug-28154-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28154
Sean Santos <quantheory at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |quantheory at gmail dot com
--- Comment #1 from Sean Santos <quantheory at gmail dot com> ---
I don't think that the original bug report here is quite right. See here:
real,allocatable :: bar(:,:),foo(:)
allocate(foo(0))
bar = spread(foo,dim=1,ncopies=1)
print *, shape(bar)
end
This prints:
1 0
That's perfectly correct; bar is "allocated" according to Fortran semantics,
but of size 0.
However, there's this related case where foo is never allocated, which seems to
be what the OP was talking about:
real,allocatable :: bar(:,:),foo(:)
bar = spread(foo,dim=1,ncopies=1)
print *, shape(bar)
end
This is not a legal use of a non-allocated variable, but "-fcheck=all" misses
it. If you run, you get:
1 1
Which is nonsense.