ICE returning abstract interface ifort 13.0.1 20121010

ICE returning abstract interface ifort 13.0.1 20121010

I have an internal compiler error when trying to return a function loaded from a dynamic library using an abstract interface and bindings to dlopen. This occurs on ifort 13.0.1 20121010 (and I believe older versions too). It compiles fine with ifort. This seems related to but not identical to previous problems reported on this forum. Error message and code below.


Joe Zuntz -bash-3.2$ ifort -c test.f90 test.f90: catastrophic error: **Internal compiler error: segmentation violation signal raised** 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 test.f90 (code 1)

module dynamic_loading
use iso_c_binding
implicit none
function dlopen(file,mode) result(handle) bind(c,name="dlopen")
use iso_c_binding
character(c_char), dimension(*), intent(in) :: file
integer(c_int), value :: mode
type(c_ptr) :: handle
end function
function dlsym(handle,name) result(funptr) bind(c,name="dlsym")
use iso_c_binding
type(c_ptr), value :: handle
character(c_char), dimension(*), intent(in) :: name
type(c_funptr) :: funptr
end function
end interface
abstract interface
function my_function_type(x) bind(c)
use iso_c_binding
integer(c_size_t), value :: x
integer(c_int) :: my_function_type
end function my_function_type
end interface
function load_my_function(library_name, function_name) result(my_function)
character(kind=c_char,len=*) :: library_name, function_name
procedure(my_function_type), pointer :: my_function
type(c_funptr) :: funptr=c_null_funptr
type(c_ptr) :: handle=c_null_ptr
integer(c_int) :: status
handle=dlopen(trim(library_name)//c_null_char, 0)
call c_f_procpointer(funptr, my_function)
end function load_my_function
end module

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Thanks - I have escalated this to the developers as issue DPD200243371.  I am confused by your saying "it compiles fine with ifort" - was there more to that sentence?

Retired 12/31/2016

Many thanks, and apologies - I meant that it compiiles fine under gfortran (4.5 and above). 

In the current version (16), an ICE no longer occurs but an incorrect warning is produced instead:

t.f90(28): warning #6178: The return value of this FUNCTION has not been defined.   [MY_FUNCTION]
procedure(my_function_type), pointer :: my_function

This will be fixed in the next major version (second half of 2016).

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today