Please check this out:
module m implicit none type :: t(n) integer, len :: n real :: x(n) end type type, public :: foo private real, allocatable :: m_x(:) type(t(:)), allocatable :: m_t contains private procedure, pass(this), public :: init end type foo contains pure subroutine init(this, x, irc) !.. Argument list class(foo), intent(inout) :: this real, intent(in) :: x(:) integer, intent(inout) :: irc !.. Local variables integer :: size_x !.. irc = 0 size_x = size(x) if (size_x > 0) then allocate( t(size_x) :: this%m_t, stat=irc ) if (irc /= 0) return this%m_t%x = sqrt(x) this%m_x = x else irc = 1 end if !.. return end subroutine init end module m program p use m, only : foo !.. implicit none !.. type(foo) :: a integer :: erc call a%init( [ 0.0, 0.0 ], erc) stop end program p
Upon compilation,
------ Build started: Project: p, Configuration: Debug|x64 ------ Compiling with Intel(R) Visual Fortran Compiler XE 15.0.2.179 [Intel(R) 64]... p.f90 101004_2054 catastrophic error: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error. compilation aborted for C:\..\p.f90 (code 1)