Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
27235 Discussions

ICE: Function `associated` bug for Intel Fortran compiler (ifort)?

zoziha
Novice
169 Views

Same as: Function `associated` bug for Intel Fortran compiler? - Help - Fortran Discourse (fortran-lang.disco...

The following code will cause ICE (Internal compiler error) to occur in `ifort`:

 

module test_m

    implicit none
    private

    public :: f, set_method

    ! local procedure pointer
    procedure(func), pointer :: f

    abstract interface
        function func(x)
            character(*), intent(in) :: x
            character(:), allocatable :: func
        end function func
    end interface

contains

    ! set method
    subroutine set_method(ifunc)
        integer, intent(in) :: ifunc
        if (ifunc == 1) then
            if (.not. associated(f, starts)) f => starts ! This line 
        elseif (ifunc == 2) then
            !...
        end if
    end subroutine set_method

    function starts(x)
        character(*), intent(in) :: x
        character(:), allocatable :: starts
        starts = ">"//x
    end function starts

end module test_m

program main

    use test_m
    implicit none

    call set_method(1)
    print *, f("string")

end program main

 

I suspect it is related to `associated` function, remove the `associated` judgment code to compile and pass:

 

    ! set method
    subroutine set_method(ifunc)
        integer, intent(in) :: ifunc
        if (ifunc == 1) then
            f => starts   ! Note here 

 

0 Kudos
2 Replies
Ron_Green
Moderator
116 Views

definitely a bug.  I'll get a bug report started and will update this post and the fortran-discourse with same.

 

Thanks for bringing this to our attention.

Barbara_P_Intel
Moderator
83 Views

I filed a bug report for this, CMPLRIL0-34800. Will post when a fix is available.



Reply