https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57284
--- Comment #4 from Gerhard Steinmetz <gerhard.steinmetz.fort...@t-online.de> --- As known, causative is the class declaration of "a", when using size(a). Some variants, replacing "class" with "type" : $ cat z2.f90 module m type t end type contains function foo(a, b) result(add) class(t), intent(in) :: a(:) type(t), intent(in) :: b(size(a)) type(t) :: add(size(a)) end function end module program p use m end program $ gfortran-6 -c z2.f90 f951: internal compiler error: find_array_spec(): unused as(1) --- $ cat z3.f90 module m type t end type contains function foo(a, b) result(add) type(t), intent(in) :: a(:) class(t), intent(in) :: b(size(a)) type(t) :: add(size(a)) end function end module program p use m end program $ gfortran-6 -c z3.f90 # ok --- $ cat z4.f90 module m type t end type contains function foo(a, b) result(add) type(t), intent(in) :: a(:) type(t), intent(in) :: b(size(a)) type(t) :: add(size(a)) end function end module program p use m end program $ gfortran-6 -c z4.f90 # ok