The following code results in an internal compiler error using ifort (IFORT) 22.214.171.124 20180804, but only when including debug symbols via -g, e.g. using ifort -g -c source.f90
module some type :: type_t contains procedure :: bar end type contains subroutine bar(this) class(type_t) :: this end subroutine function foobar(var) class(type_t), intent(in) :: var call var%bar end function end module function foo(arr) integer, intent(in) :: arr(:) integer :: foo(size(arr)) end function
I tried to minimize the code as much as possible, but the warnings connected to the compilation are apparently unrelated to the problem which originates in the last but one line. Is there any workaround I can do to compile this code without changing it semantically? Thanks!
Have you tried a newer compiler? 19.0.5 is current. I don't have Linux, but I tried this on Windows with 19.0.5 and /debug and it compiled. Debug support is different enough on the platforms, though, that this doesn't necessarily mean anything.
.. Is there any workaround I can do to compile this code without changing it semantically? ..
What do you mean by not changing the code "semantically"? You can contact Intel Support, if you are able to, and try to get more insight on the insidious "internal compiler error" (ICE) which, as you know, is always a compiler bug. That might then point you toward your options to workaround the ICE. If not, you can try to fix your non-conforming function 'foobar' and declare the function result and define it also as shown below which should then allow your compiler to avoid the ICE:
function foobar(var) result(r) class(type_t), intent(in) :: var integer :: r call var%bar r = 42 end function
Or you can switch to another different compiler like the latest of Intel Fortran.