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

ICE/Bug: constructor for derived type with polymorphic allocatable component

DataScientist
Valued Contributor I
1,160 Views

The following code generates an ICE with the Intel classic Fortran compiler 2023 ifort:

    type :: con_type
        class(*), allocatable :: value
    end type

    interface con_type
        procedure :: constructCon
    end interface

    type(con_type), allocatable :: a(:)

    a = [con_type([1, 2]), con_type(1)]

contains

    function constructCon(value) result(con)
        class(*), intent(in) :: value(:)
        type(con_type) :: con(size(value))
        integer :: i
        do i = 1, size(value)
            con(i)%value = value(i)
        end do
    end function

end

Here is the error message:

/app/example.f90(1): catastrophic error: **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.
compilation aborted for /app/example.f90 (code 1)

 

The source of the ICE is line number 17, where the function output is declared as an automatic array:

```fortran
type(con_type) :: con(size(value))
```
If one changes the declaration to
```fortran
type(con_type), allocatable :: con(:)
```

then the error is resolved. Is this code standard compliant?

1 Solution
Barbara_P_Intel
Employee
1,044 Views

I asked one of the Fortran compiler team; he represents Intel at the Fortran standards committee. He says your code is legal and I should file a bug. I did that already.


View solution in original post

6 Replies
andrew_4619
Honored Contributor III
1,090 Views

There are a few things that don't seem right to me about your example but I will leave that to other  with more expertise in this area. Anyway an ICE is a bug irrespective of if the code is good or bad.  My other motive is seeing if I can actually post after the forum update.... I nearly said "upgrade" but that would need more evidence.....

 

0 Kudos
Barbara_P_Intel
Employee
1,065 Views

Yes, the Forums are working again. The security update to the login took longer than planned.

I filed a bug report on this, COMPLRLLVM-44906. So glad you found a workaround!



0 Kudos
Barbara_P_Intel
Employee
1,045 Views

I asked one of the Fortran compiler team; he represents Intel at the Fortran standards committee. He says your code is legal and I should file a bug. I did that already.


DataScientist
Valued Contributor I
1,039 Views

Thanks for taking the extra step to check the standard compliance. The new portal looks great and is better than the old interface.

0 Kudos
Barbara_P_Intel
Employee
914 Views

This ICE is resolved in ifx that was released this week. It's part of oneAPI 2023.2 HPC Toolkit. Please check it out.



DataScientist
Valued Contributor I
904 Views

fantastic! thank you.

0 Kudos
Reply