https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119338
Bug ID: 119338
Summary: Type-spec in ALLOCATE of dummy with assumed length
shall use asterisk
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gcc dot gnu.org
Target Milestone: ---
The following code is silently accepted:
module m
implicit none
contains
subroutine sub(s)
character(len=*), allocatable, intent(out) :: s(:)
allocate(character(*) :: s(5)) ! OK
allocate(character(len=10) :: s(5)) ! invalid
allocate(character(len(s)) :: s(5)) ! invalid
end subroutine sub
end module m
Note that F2023 has:
! C939 (R929) A type-param-value in a type-spec shall be an asterisk if and
! only if each allocate-object is a dummy argument for which the
! corresponding type parameter is assumed.