https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72832
Dominique d'Humieres <dominiq at lps dot ens.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P4 Known to work| |5.4.0 Summary|[OOP] ALLOCATE with SOURCE |[6/7 Regression] [OOP] |fails to allocate requested |ALLOCATE with SOURCE fails |dimensions |to allocate requested | |dimensions Known to fail| |6.1.0, 7.0 --- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- BTW this is a regression. Compiling the code with 5.4.0 gives at runtime the output 2 4 if compiled without -fcheck=bounds and 2 At line 11 of file pr72832.f90 Fortran runtime error: Array bound mismatch for dimension 1 of array 'b' (4/2) with it. > Just out of interest: what is the recommended way to allocate a class(t) > variable of the same type as a but different size? Not 100% sure, but may be you can use a scalar (it does seem to work for me).