Skip to content

[Flang] GENERIC INTERFACE: Incorrect diagnose when the proc-interface of a procedure pointer is a function that returns polymorphic pointer #82390

Closed
@DanielCChen

Description

@DanielCChen
Contributor

Consider the following code:

  MODULE M

    TYPE :: DT
      INTEGER :: ID
    END TYPE

    CONTAINS

    FUNCTION ModDt(Arg)
    TYPE(DT) :: Arg
    CLASS(DT), POINTER :: ModDt
    END FUNCTION

  END MODULE

  PROGRAM PtrAssignGen
  USE M
  IMPLICIT NONE

  INTERFACE ModDt
    MODULE PROCEDURE  ModDt
  END INTERFACE

  PROCEDURE(ModDt), POINTER :: ProcPtr

  END

Flang currently issues an error as

./t.f:21:5: error: A PROCEDURE statement is only allowed in a generic interface block
    MODULE PROCEDURE  ModDt
    ^^^^^^^^^^^^^^^^^^^^^^^

The code seems conforming to me. If I remove the generic name from the interface block, it compiles successfully.

Activity

llvmbot

llvmbot commented on Feb 20, 2024

@llvmbot
Member

@llvm/issue-subscribers-bug

Author: Daniel Chen (DanielCChen)

Consider the following code: ``` MODULE M
TYPE :: DT
  INTEGER :: ID
END TYPE

CONTAINS

FUNCTION ModDt(Arg)
TYPE(DT) :: Arg
CLASS(DT), POINTER :: ModDt
END FUNCTION

END MODULE

PROGRAM PtrAssignGen
USE M
IMPLICIT NONE

INTERFACE ModDt
MODULE PROCEDURE ModDt
END INTERFACE

PROCEDURE(ModDt), POINTER :: ProcPtr

END


Flang currently issues an error as

./t.f:21:5: error: A PROCEDURE statement is only allowed in a generic interface block
MODULE PROCEDURE ModDt
^^^^^^^^^^^^^^^^^^^^^^^


The code seems conforming to me. If I remove the generic name from the interface block, it compiles successfully. 
  
</details>
llvmbot

llvmbot commented on Feb 20, 2024

@llvmbot
Member

@llvm/issue-subscribers-flang-frontend

Author: Daniel Chen (DanielCChen)

Consider the following code: ``` MODULE M
TYPE :: DT
  INTEGER :: ID
END TYPE

CONTAINS

FUNCTION ModDt(Arg)
TYPE(DT) :: Arg
CLASS(DT), POINTER :: ModDt
END FUNCTION

END MODULE

PROGRAM PtrAssignGen
USE M
IMPLICIT NONE

INTERFACE ModDt
MODULE PROCEDURE ModDt
END INTERFACE

PROCEDURE(ModDt), POINTER :: ProcPtr

END


Flang currently issues an error as

./t.f:21:5: error: A PROCEDURE statement is only allowed in a generic interface block
MODULE PROCEDURE ModDt
^^^^^^^^^^^^^^^^^^^^^^^


The code seems conforming to me. If I remove the generic name from the interface block, it compiles successfully. 
  
</details>
DanielCChen

DanielCChen commented on Feb 26, 2024

@DanielCChen
ContributorAuthor

The test case in the issue compiles successfully now.
Just to confirm that PR #82837 fixed this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorflang:frontend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @DanielCChen@llvmbot

        Issue actions

          [Flang] GENERIC INTERFACE: Incorrect diagnose when the proc-interface of a procedure pointer is a function that returns polymorphic pointer · Issue #82390 · llvm/llvm-project