https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89558

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to Thomas Koenig from comment #0)
> 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
> 

Gfortran's behavior is correct.  This should be closed as INVALID.
If you wrote 'allocate(z(2,2))', then the missing lower bound
is assumed to be 1.  But, you included the colon, which means that
lower-bound-expr is expected, and R934 applies

R934 lower-bound-expr  is scalar-int-expr

R933 isn 't
R933 allocate-shape-spec is  [ [ lower-bound-expr ] : ] upper-bound-expr

where lower-bound-expr is optional.

Reply via email to