https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71936
--- Comment #2 from Gerhard Steinmetz <gerhard.steinmetz.fort...@t-online.de> --- To get the whole picture it's necessary to take a look at four analogous cases with "type" instead of "class". They compile without an error (v6/v7), but occationally run for a long time (y3/y4). $ cat y1.f90 program p type t end type type(t), allocatable :: x(:) allocate (x, mold=f()) deallocate (x) allocate (x, source=f()) contains function f() type(t), allocatable :: f(:) end end $ cat y2.f90 program p type t end type type(t), allocatable :: x(:) allocate (x, mold=f()) deallocate (x) allocate (x, source=f()) contains function f() type(t), pointer :: f(:) end end $ cat y3.f90 program p type t end type type(t), pointer :: x(:) allocate (x, mold=f()) deallocate (x) allocate (x, source=f()) contains function f() type(t), allocatable :: f(:) end end $ cat y4.f90 program p type t end type type(t), pointer :: x(:) allocate (x, mold=f()) deallocate (x) allocate (x, source=f()) contains function f() type(t), pointer :: f(:) end end $ gfortran-5 y4.f90 y4.f90:5:13: allocate (x, mold=f()) 1 Error: Array specification required in ALLOCATE statement at (1) y4.f90:7:13: allocate (x, source=f()) 1 Error: Array specification required in ALLOCATE statement at (1) $ $ gfortran-7-20160717 y4.f90 $ $ time timeout 100.0 a.out real 1m40.002s user 1m40.046s sys 0m0.003s