https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91646
--- Comment #8 from G. Steinmetz <gs...@t-online.de> --- First a remark, the phrase "the facts" had an unintended sound, should be read as "the given" or similar. --- It is apparently not necessary to have a cascade of several types, a single one suffices. Associated generator : $ cat generator_type_long.f90 program generator_type_long implicit none character(*), parameter :: fmt = '(*(a,i6.6))' integer :: n ! number of base items integer :: i read(*,*) n n = max (0, min (n, 999999)) print fmt, 'module m' print fmt, ' type t', 0 do i = 1, n print fmt, ' real, allocatable :: a', i, '(:)' end do print fmt, ' end type' print fmt, 'end module' end The output then looks like : module m type t000000 real, allocatable :: a000001(:) ... real, allocatable :: a004000(:) end type end module Similar to comment 5 a variant with "real, pointer" is placed next to it, and one with fixed size "real :: a...(10)" Intentional tested with a very old box, some results : ------- allocatable ------- pointer fixed a(10) N user time memory user time user time 500 3.1 sec 130 MB 0.026 sec 0.031 sec 1000 7.8 sec 250 MB 0.046 sec 0.045 sec 2000 20.3 sec 540 MB 0.087 sec 0.091 sec 3000 42.2 sec 850 MB 0.125 sec 0.145 sec 4000 68.5 sec 1090 MB 0.180 sec 0.213 sec For this limited range, memory consumption is roughly ~ N. OTOH, run time raises from N=1000 to 4000 by a factor of 9. For higher numbers not necessarily monotone. Memory consumption goes up stepwise, e.g. for N=4000 between 26 and 58 sec consumption is constant 510 MB, then doubles between 59 and 63 sec to 1040 MB. In general depending on size/speed of caches/ram/disc and other. For slightly different numbers N and N+1, output and dumps can be diff compared, but not done here. Numbers vary for different OS, CPU, compiler versions, etc.