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

ICE when using structure constructors for function pointer components

Sean_S_2
Beginner
430 Views

Here is some example code:

program test_function_constructor

implicit none

abstract interface
   integer function get_int()
   end function get_int
end interface

type :: foo
   procedure(get_int), nopass, pointer :: get => null()
end type foo

type(foo) :: bar

bar = foo(foo_int) ! Causes ICE
bar%get => foo_int ! OK (my current workaround)

contains

  integer function foo_int()
    foo_int = 0
  end function foo_int

end program test_function_constructor

 

There was a previous bug about a similar issue here:

http://software.intel.com/en-us/forums/topic/270982

That bug was fixed and the test case there still is OK. This new bug triggers in different circumstances. Namely:

  1. The type being constructed must be declared in the same module (or as above, program block) as the code that uses the constructor.
  2. The procedure pointer must point to a function, not a subroutine.

If either of those conditions isn't met, the code compiles fine. Unlike the earlier issue, it doesn't matter in this case if you default-initialize the function pointer to null().

0 Kudos
2 Replies
Kevin_D_Intel
Employee
430 Views

Thank you for reporting this error and for the convenient test case. I reproduced the error and reported it to Developers (see internal tracking id below). I will keep the post updated on the status of a fix as I learn it.

(Internal tracking id: DPD200255193)

(Resolution Update on 11/17/2014): This defect is fixed in the Intel® Parallel Studio XE 2015 Update 1 release (2015.0.133 - Linux)

0 Kudos
Kevin_D_Intel
Employee
430 Views

This defect is fixed in the Intel® Parallel Studio XE 2015 Update 1 release (Version 15.0.1.133 Build 20141023 - Linux) now available from our Intel® Registration Center.

0 Kudos
Reply