Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29251 ディスカッション

Parameterized derived type with type-bound procedure: unexpected run-time error [forrtl: severe (408): fort: (10)..]

FortranFan
名誉コントリビューター III
622件の閲覧回数

The following simple code compiles with no errors or warnings, but generates a run-time error [forrtl: severe (408): fort: (10)..].  I think the code is alright, please correct me otherwise.

module m

   implicit none

   private

   type, public :: t(n)
      private
      integer, len :: n = 1
      integer :: m_x(n)
   contains
      procedure, pass(this), public :: load => load_t_x
   end type t

contains

   subroutine load_t_x(this, dat)

      class(t(*)), intent(inout)               :: this
      integer(kind=kind(this%m_x)), intent(in) :: dat(:)

      this%m_x = dat

      return

   end subroutine load_t_x

end module m

program p

   use m, only : t

   type(t(n=2)) :: foo

   call foo%load( [ 1, 2 ] )

   stop

end program p

Upon execution,

forrtl: severe (408): fort: (10): Subscript #1 of the array M_X has value 1 whic
h is greater than the upper bound of 0

Image              PC                Routine            Line        Source

p.exe              000000013F9744B0  Unknown               Unknown  Unknown
p.exe              000000013F9710BD  M_mp_LOAD_T_X              22  m.f90
p.exe              000000013F971349  MAIN__                      7  p.f90
p.exe              000000013F99707E  Unknown               Unknown  Unknown
p.exe              000000013F997360  Unknown               Unknown  Unknown
kernel32.dll       00000000772359ED  Unknown               Unknown  Unknown
ntdll.dll          000000007736BA01  Unknown               Unknown  Unknown
Press any key to continue . . .

 

0 件の賞賛
3 返答(返信)
Steven_L_Intel1
従業員
622件の閲覧回数

From what I can see, it's only the bounds checking error that is the problem, as the assignment is otherwise done successfully. Escalated as issue DPD200367073. Thanks.

FortranFan
名誉コントリビューター III
622件の閲覧回数

Thanks Steve.  Yes, /check:bounds option was being used.  Now I have a workaround.

Steven_L_Intel1
従業員
622件の閲覧回数

I expect this to be fixed in Update 3, due in May.

返信