Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28381 Discussions

17.07 compiler crash when default initialisation of procedure pointer

may_ka
Beginner
196 Views

FYI,

17.07 compiler crashes with the code below. Workaround is to initialize the procedure pointer with "=>Null()". Support ticket has been submitted.

Module test
  Interface
    Module Subroutine bla1()
    End Subroutine
  end Interface
  Procedure(bla1), pointer :: pbla=>bla1
end Module test
Submodule(test) subtest
contains
  Module Procedure bla1
  end Procedure
end Submodule subtest

 

0 Kudos
2 Replies
Juergen_R_R
Valued Contributor I
196 Views

Indeed this gives an ICE with ifort 17.07. This seems to work at least with ifort 18.0.3 and ifort 19.0.0.

0 Kudos
Martin1
New Contributor I
196 Views

I have encountered a very similar problem, which was present in ifort19 beta, and which is not fixed in ifort19 (have not tested it, but was told so by support):

It is essential that (see code below):
(1) character(len=:) is used as type of result.
(2) the abstract interface ifc and the function fun are in a separate module.

I also found out that with integer instead of character(len=:) it works, but with logical it also fails...
All in all, I am a bit surprised that a beta version is made available, but almost no bugs I have reported where fixed (though most were not really serious). But this one is a bit cumbersome to work around (in the end I have copied the few concerned routines into the module where I required them).

module bar

implicit none
private

public ifc
public fun

   abstract interface
      function ifc() result(x)
         character(len=:), allocatable :: x
      end function ifc
   end interface


contains

   function fun() result(x)
      character(len=:), allocatable :: x
      x = ''
   end function fun

end module bar
module mod

use bar

implicit none
private

   type, public :: t
      procedure(ifc), nopass, pointer, public :: f => fun
   end type t

end module mod

 

0 Kudos
Reply