- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I filed a bug report for this, CMPLRIL0-34800. Will post when a fix is available.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The ICE when using ASSOCIATED() is fixed in the current release of the compiler. It was made available in December and is part of oneAPI HPC Toolkit 2023.0.
Try it out!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page