https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125669
Bug ID: 125669
Summary: [PDT] Parameterized constant size and string length
components are allocated and freed
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: pault at gcc dot gnu.org
Target Milestone: ---
module m
implicit none
type :: t(k1, k2)
integer, kind :: k1, k2
real :: v(k1*k2, max(k1,k2))
character(len = k1+k2-1) :: c
end type
end module
program p
use m
implicit none
integer, parameter :: n=3, k=2
type(t(n,k)) :: x
if (any (shape(x%v) /= [6,3])) stop 1
if (len(x%c) /= 4) stop 2
end program
compiles with gfortran such that the components v & c are allocated and freed
unnecessarily as evidenced by the tree dump.
I have known about this for a long time but haven't mustered the cycles to deal
with it.
Paul