Code below compiles and functions as expected with Intel 2013, 15, and 16. Intel 17 gives ICE. Other compilers seem to handle it as well. We have a workaround in the "big" code, but would be curious to know if this is valid code or not.
ifort (IFORT) 17.0.1 20161005
Copyright (C) 1985-2016 Intel Corporation. All rights reserved.
module prob type ddt1 real :: f ! function real :: d ! the derivatives of f end type ddt1 interface assignment(=) module procedure ddt1_assign_rd end interface contains function fun_rd(v1) result(f1) real, intent(in) :: v1 type(ddt1) :: f1 f1%f = v1 f1%d = 0.0 end function fun_rd subroutine ddt1_assign_rd(r, d) real, intent(out) :: r type(ddt1), intent(in) :: d r = d%f end subroutine ddt1_assign_rd end module program problem use prob implicit none real :: var1 var1 = 1.0 var1 = fun_rd(var1) print *, var1 end program problem
The code looks conformant. I note the internal error occurs where var1 appears as the argument to fun_rd. The internal error should not occur whether the code is conformant or not. Thank you for reporting this and for the convenient reproducer. I reported this to our Developers.
(Internal tracking id: DPD200417568)