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

Compiler bug with submodules and procedure pointers

OP1
New Contributor II
639 Views

This code fails to compile with the latest ifort 2021.6.0 and ifx 2022.1.0 compilers.

Note that if the definition of the procedure pointer is in the parent module, the code compiles just fine.

Sigh...

MODULE M
IMPLICIT NONE (TYPE, EXTERNAL)
! Declaring P_ACTUAL here works.
!PROCEDURE(P), POINTER :: P_ACTUAL 
INTERFACE
    MODULE SUBROUTINE P
    END SUBROUTINE P
END INTERFACE
END MODULE M

SUBMODULE (M) SM
IMPLICIT NONE (TYPE, EXTERNAL)
! Declaring P_ACTUAL here fails.
PROCEDURE(P), POINTER :: P_ACTUAL
END SUBMODULE SM

SUBMODULE (M : SM) P
IMPLICIT NONE (TYPE, EXTERNAL)
CONTAINS
    MODULE SUBROUTINE P
    IMPLICIT NONE (TYPE, EXTERNAL)
    IF (ASSOCIATED(P_ACTUAL)) THEN
    END IF
    END SUBROUTINE P
END SUBMODULE P
0 Kudos
5 Replies
Barbara_P_Intel
Employee
602 Views

I don't get an ICE with this reproducer with either ifx or ifort.

Can you please send the version number you get when you add the compiler option "-what"?

$ ifort -what -c icy.f90
 Intel(R) Fortran 2021.6.0-1299
icy.f90(22): error #6404: This name does not have a type, and must have an explicit type.   [P_ACTUAL]
    IF (ASSOCIATED(P_ACTUAL)) THEN
-------------------^
icy.f90(22): error #6106: Not a valid argument for ASSOCIATE or SELECT TYPE.   [ASSOCIATED]
    IF (ASSOCIATED(P_ACTUAL)) THEN
-------------------^
compilation aborted for icy.f90 (code 1)

$ ifx -what -c icy.f90
 Intel(R) Fortran 22.0-1296
icy.f90(22): error #6404: This name does not have a type, and must have an explicit type.   [P_ACTUAL]
    IF (ASSOCIATED(P_ACTUAL)) THEN
-------------------^
icy.f90(22): error #6106: Not a valid argument for ASSOCIATE or SELECT TYPE.   [ASSOCIATED]
    IF (ASSOCIATED(P_ACTUAL)) THEN
-------------------^
compilation aborted for icy.f90 (code 1)

  

0 Kudos
OP1
New Contributor II
597 Views

Barbara - the code indeed does not produce an ICE. But it should still compile without any errors, and that's not the case.

0 Kudos
Barbara_P_Intel
Employee
595 Views

Ah! You had me thinking ICE after the earlier issue. THANKS!


0 Kudos
Barbara_P_Intel
Employee
584 Views

I filed a bug report for you, CMPLRLLVM-37576.


0 Kudos
Barbara_P_Intel
Employee
429 Views

The reproducer now compiles without error with the latest Fortran compilers, ifort 2021.7.0 and ifx 2022.2.0. Both are part of the oneAPI HPC 2022.3 Toolkit that was released earlier this month.

Give the new compilers a try!



0 Kudos
Reply