- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A colleague brought up the following code, for which the latest compiler (ifx 2024.2.0) issues an error message when trying to compile line 36: "error #8486: There is no matching specific subroutine for this type bound generic subroutine call. [G]"
The fortran standard says in section 16.9.155 NULL([MOLD]) : "If the context of the reference to NULL is an actual argument in a generic procedure reference, MOLD shall be present if the type, type parameters, or rank are required to resolve the generic reference."
In this example, there is only one specific procedure, and thus resolving the generic interface should be possible even if NULL() is passed as argument to the generic procedure.
Could this be a bug in the compiler?
MODULE M
IMPLICIT NONE (TYPE, EXTERNAL)
TYPE :: T1
CONTAINS
PROCEDURE, PUBLIC :: P
GENERIC, PUBLIC :: G => P
END TYPE T1
TYPE :: T2
END TYPE T2
CONTAINS
SUBROUTINE P(SELF, O_T2)
CLASS(T1) :: SELF
CLASS(T2), POINTER :: O_T2
END SUBROUTINE P
END MODULE M
PROGRAM P
USE :: M
IMPLICIT NONE (TYPE, EXTERNAL)
TYPE(T1) :: O_T1
CLASS(T2), POINTER :: O_T2 => NULL()
! All those calls with the specific subroutine P
! can be compiled.
CALL O_T1%P(O_T2)
CALL O_T1%P(NULL(O_T2))
CALL O_T1%P(NULL())
! When using the generic procedure G, the 3rd
! CALL statement below cannot be compiled.
CALL O_T1%G(O_T2)
CALL O_T1%G(NULL(O_T2))
CALL O_T1%G(NULL()) ! Compiler issues an error. But should it?
END PROGRAM P
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This case is escalated to compiler engineering for further investigation and a fix.
![](/skins/images/8B6E2C8F64F54CBD7F7262AA46F575DA/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page