https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89558
Bug ID: 89558
Summary: Recects missing lower bound expression in
allocate-shape-spec-list
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
Target Milestone: ---
program p
integer, allocatable :: z(:,:)
allocate (z(:2,2))
end
is valid, but is rejected with current trunk:
a.f90:3:13:
3 | allocate (z(:2,2))
| 1
Error: Bad array specification in ALLOCATE statement at (1)
J3/18-007r1 says:
9.7.1.1 Form of the ALLOCATE statement
R933 allocate-shape-spec is [ lower-bound-expr : ] upper-bound-expr
9.7.1.2 Execution of an ALLOCATE statement
When an ALLOCATE statement is executed for an array for which
allocate-shape-spec-list is specified, the values
of the lower bound and upper bound expressions determine the bounds of the
array. Subsequent redefinition
or undefinition of any entities in the bound expressions do not affect the
array bounds. If the lower bound is
omitted, the default value is 1. If the upper bound is less than the lower
bound, the extent in that dimension is
zero and the array has zero size.
so this should be accepted.