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

Nested SELECT TYPE and SELECT RANK constructs.

OP1
New Contributor III
1,110 Views

I get an access violation error with ifort 2021.9.0 ... and an ICE with ifx 2023.1.0 with the following code.

 

MODULE M
IMPLICIT NONE (TYPE, EXTERNAL)
CONTAINS

    SUBROUTINE S(X)
    IMPLICIT NONE (TYPE, EXTERNAL)
    CLASS(*) :: X(..)
    SELECT RANK (X)
        RANK (0)
            SELECT TYPE (XX => X)
                TYPE IS (INTEGER)
                    WRITE(*, *) 'X is of type INTEGER.'
            END SELECT 
    END SELECT
    END SUBROUTINE S

END MODULE M

PROGRAM P
USE M
IMPLICIT NONE (TYPE, EXTERNAL)
INTEGER :: I
CALL S(I)
END PROGRAM P

 

Either there is a missing check in the compiler to prevent those nested constructs, or this is a legal code but there is a compiler bug.

0 Kudos
5 Replies
FortranFan
Honored Contributor III
1,089 Views

The code appears conformant, it looks like a bug in IFORT.

Intel team: FYI, IFX encounters ICE with this.

0 Kudos
Ron_Green
Moderator
1,078 Views

we will get a bug report open.  Thanks for sending this to us! 

0 Kudos
Ron_Green
Moderator
992 Views

bug ID is CMPLRLLVM-48814


0 Kudos
Ron_Green
Moderator
643 Views

@OP1 this bug is fixed in the 2024.1.0 compiler.  I have just confirmed the fix in the released compiler.

0 Kudos
riad_h_1
Novice
227 Views

Hello,

For Mac Os users who can't benefit from new releases (ifort no longer maintained...), does anyone have a workaround for this problem?

0 Kudos
Reply