Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.
27549 Discussions

INTERNAL COMPILER ERROR: module/submodule with fixed-len allocatable character dummy argument

DataScientist
Valued Contributor I
467 Views

The following code appears to be standard-conforming but does not compile with Intel ifort 2021.5:

module mod
    interface unique
        module function findUnique(Array) result(unique)
            character(*), intent(in), contiguous    :: array(:)
            character(len(array))   , allocatable   :: unique(:)
        end function
    end interface
end module mod

submodule (mod) smod
contains
    module procedure findUnique
    end procedure
end submodule smod

end

The code can be readily tested online here to reproduce the ICE message.

Gfortran 11 can compile the same code. Note that the problem appears to be entirely due to the specification of the length-type parameter of the allocatable output. For example, the following code works just fine,

module mod
    interface unique
        module function findUnique(Array) result(unique)
            character(*), intent(in), contiguous    :: array(:)
            character(:)            , allocatable   :: unique(:)
        end function
    end interface
end module mod

submodule (mod) smod
contains
    module procedure findUnique
    end procedure
end submodule smod
end

Specifying the interface in both the submdule and the module also resolves the ICE, if I remember correctly. But interface-duplication is an ugly least-wanted solution for an ICE.

 

0 Kudos
1 Solution
Ron_Green
Moderator
367 Views

The stack trace on this is almost identical to your previously reported issue https://community.intel.com/t5/Intel-Fortran-Compiler/INTERNAL-COMPILER-ERROR-allocatable-and-contig... so I have added it to the existing bug report CMPLRIL0-34555. We'll make sure both your examples work when this bug is addressed.



View solution in original post

4 Replies
Ron_Green
Moderator
383 Views

I have a Fedora 35 system with gfortran.  Yes, looks like a bug.  I'll write it up.  Thank you for this simple bug reproducer! 

Ron_Green
Moderator
368 Views

The stack trace on this is almost identical to your previously reported issue https://community.intel.com/t5/Intel-Fortran-Compiler/INTERNAL-COMPILER-ERROR-allocatable-and-contig... so I have added it to the existing bug report CMPLRIL0-34555. We'll make sure both your examples work when this bug is addressed.



Ron_Green
Moderator
287 Views

I was wrong, these cases are triggering 2 bugs in the front end.  the first, your first issue, the developer has identified and has a pending fix for that one.  This new one is ever so slightly different.  Very close code paths but different.  She's working on this 2nd case now.

 

We did miss code freeze for the next update release for both of these.  So the Update that releases next, in the next month or so, will not have the fixes.  I will keep you posted on when to expect two fixes.

 

ron

DataScientist
Valued Contributor I
285 Views

Fantastic, Thank you very much for the rapid responses and updates.

Reply