Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28741 Discussions

Bug Report ICE #5623: associated() compile-time error

jeffhole
Novice
485 Views

Compiler: ifx (IFX) 2024.2.0 20240602 (ifx --version)

OS: Rocky Linux 8.9 (Green Obsidian)

 

I'm not sure how to describe this bug, but here is the code (file attached) that produces the internal compiler error:

! file: minimum_test_to_produce_ice.f90
module EventQueueHeader
    implicit none

    type Event
    end type

    class(Event), pointer :: EVENT_NOW => null()

    type EventList
        contains
        generic, public :: get => get_Event
        procedure, private :: get_Event
        procedure, public :: size => size_EventList
    end type
        interface
            module function get_Event(this,idx) result(object)
                class(EventList), intent(inout) :: this
                integer, intent(in) :: idx
                class(Event), pointer :: object
            end function
            module function size_EventList(this) result(n)
                class(EventList), intent(inout) :: this
                integer :: n
            end function
        end interface

    type EventQueue
        private
        type(EventList) :: events
        contains
        procedure, public :: finalizeCurrentEvent => finalizeCurrentEvent_EventQueue
    end type
        interface
            module subroutine finalizeCurrentEvent_EventQueue(this)
                class(EventQueue), intent(inout) :: this
            end subroutine
        end interface
end module

submodule(EventQueueHeader) EventQueueImplementation
    implicit none
    contains
    module subroutine finalizeCurrentEvent_EventQueue(this)
        class(EventQueue), intent(inout) :: this
        integer :: k
        do k = 1, this%events%size()
            if(associated(this%events%get(k),EVENT_NOW)) then
                ! do something
                return
            end if
        end do
    end subroutine
end submodule

This ICE occurs if the above code is in a single source file as well as broken apart into two (module and submodule). I compile this on the command line:

ifx -c minimal_test_to_produce_ice.f90

Here is the compiler output:

ifx -c minimal_test_to_produce_ice.f90 
 #0 0x0000000003191cf7 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x3191cf7)
 #1 0x000000000317d7d6 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x317d7d6)
 #2 0x000000000309da73 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x309da73)
 #3 0x00000000030a3951 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x30a3951)
 #4 0x0000000003194dfa (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x3194dfa)
 #5 0x0000000003198eda (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x3198eda)
 #6 0x0000000003169960 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x3169960)
 #7 0x000000000316a5d8 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x316a5d8)
 #8 0x00000000031de4ab (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x31de4ab)
 #9 0x00000000031e0db4 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x31e0db4)
#10 0x00000000031e1335 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x31e1335)
#11 0x0000000003166477 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x3166477)
#12 0x0000000003166129 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x3166129)
#13 0x0000000003167fee (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x3167fee)
#14 0x00000000031e0db4 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x31e0db4)
#15 0x00000000031e1335 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x31e1335)
#16 0x00000000031e3d70 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x31e3d70)
#17 0x00000000031e0db4 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x31e0db4)
#18 0x00000000031e1335 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x31e1335)
#19 0x00000000031deb72 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x31deb72)
#20 0x00000000031e0db4 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x31e0db4)
#21 0x00000000031de22a (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x31de22a)
#22 0x00000000031e0db4 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x31e0db4)
#23 0x0000000003078656 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x3078656)
#24 0x0000000003078005 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x3078005)
#25 0x000000000324dd27 (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x324dd27)
#26 0x00007f4b84120d85 __libc_start_main (/lib64/libc.so.6+0x3ad85)
#27 0x0000000002eb058a (/opt/intel/oneapi/compiler/2024.2/bin/compiler/xfortcom+0x2eb058a)

minimal_test_to_produce_ice.f90(48): error #5623: **Internal compiler error: internal abort** 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.
            if(associated(this%events%get(k),EVENT_NOW)) then
---------------^
compilation aborted for minimal_test_to_produce_ice.f90 (code 3)

 

Labels (2)
0 Kudos
1 Solution
Devorah_H_Intel
Moderator
249 Views

Thank you very much for the ICE report and workaround. I have confirmed and escalated this case to our compiler engineering for a fix.



View solution in original post

0 Kudos
2 Replies
jeffhole
Novice
449 Views

I found a workaround for this bug. I'll only show the relevant portion, and I'll attach the workaround source file.

 

In the submodule's finalizeCurrentEvent_EventQueue() subroutine, all I had to do was save off the result of the get() function to a local variable:

!==================
! ORIGINAL (BUG)
!==================
module subroutine finalizeCurrentEvent_EventQueue(this)
    class(EventQueue), intent(inout) :: this
    integer :: k
    do k = 1, this%events%size()
        if(associated(this%events%get(k),EVENT_NOW)) then
            ! do something
            return
        end if
    end do
end subroutine

!==================
! WORKAROUND
!==================
module subroutine finalizeCurrentEvent_EventQueue(this)
    class(EventQueue), intent(inout) :: this
    integer :: k
    class(Event), pointer :: thisEvent => null()
    do k = 1, this%events%size()
        thisEvent => this%events%get(k)
        if(associated(thisEvent,EVENT_NOW)) then
            ! do something
            return
        end if
    end do
end subroutine

 

Devorah_H_Intel
Moderator
250 Views

Thank you very much for the ICE report and workaround. I have confirmed and escalated this case to our compiler engineering for a fix.



0 Kudos
Reply