Skip to content

[Flang] GENERIC INTERFACE: BINC(C) attribute not propagate to the generic name that is the same as the specific name that has the BIND(C) attribute.  #82267

Closed
@DanielCChen

Description

@DanielCChen
Contributor

Consider the following code:

  MODULE M
  USE ISO_C_BINDING

  INTERFACE ExtFun
    FUNCTION ExtFun() BIND(C)
    IMPORT
      INTEGER(C_INT) :: ExtFun
    END FUNCTION
  END INTERFACE

  END MODULE

  PROGRAM MAIN
  USE M
  PROCEDURE(ExtFun), BIND(C), POINTER :: PExtFun
  END

Flang currently issues an error as:

: error: An interface name with BIND attribute must be specified if the BIND attribute is specified in a procedure declaration statement
    PROCEDURE(ExtFun), BIND(C), POINTER :: PExtFun
                                           ^^^^^^^

It passes if I remove the generic name. The BIND(C) attribute seems missing from both the generic and specific symbol in the dump.

Activity

llvmbot

llvmbot commented on Feb 19, 2024

@llvmbot
Member

@llvm/issue-subscribers-flang-frontend

Author: Daniel Chen (DanielCChen)

Consider the following code: ``` MODULE M USE ISO_C_BINDING

INTERFACE ExtFun
FUNCTION ExtFun() BIND(C)
IMPORT
INTEGER(C_INT) :: ExtFun
END FUNCTION
END INTERFACE

END MODULE

PROGRAM MAIN
USE M
PROCEDURE(ExtFun), BIND(C), POINTER :: PExtFun
END


Flang currently issues an error as:

: error: An interface name with BIND attribute must be specified if the BIND attribute is specified in a procedure declaration statement
PROCEDURE(ExtFun), BIND(C), POINTER :: PExtFun
^^^^^^^


It passes if I remove the generic name. The `BIND(C)` attribute seems missing from both the generic and specific symbol in the dump.
</details>
llvmbot

llvmbot commented on Feb 19, 2024

@llvmbot
Member

@llvm/issue-subscribers-bug

Author: Daniel Chen (DanielCChen)

Consider the following code: ``` MODULE M USE ISO_C_BINDING

INTERFACE ExtFun
FUNCTION ExtFun() BIND(C)
IMPORT
INTEGER(C_INT) :: ExtFun
END FUNCTION
END INTERFACE

END MODULE

PROGRAM MAIN
USE M
PROCEDURE(ExtFun), BIND(C), POINTER :: PExtFun
END


Flang currently issues an error as:

: error: An interface name with BIND attribute must be specified if the BIND attribute is specified in a procedure declaration statement
PROCEDURE(ExtFun), BIND(C), POINTER :: PExtFun
^^^^^^^


It passes if I remove the generic name. The `BIND(C)` attribute seems missing from both the generic and specific symbol in the dump.
</details>
changed the title [-][Flang] BINC(C) attribute not propagate to the generic name that is the same as the specific name that has the BIND(C) attribute. [/-] [+][Flang] GENERIC INTERFACE: BINC(C) attribute not propagate to the generic name that is the same as the specific name that has the BIND(C) attribute. [/+] on Feb 20, 2024
self-assigned this
on Feb 23, 2024
klausler

klausler commented on Feb 23, 2024

@klausler
Contributor
DanielCChen

DanielCChen commented on Feb 27, 2024

@DanielCChen
ContributorAuthor

I have verified PR #82837 has fixed the reproducer and the original test case.
Thanks for the quick fix! @klausler

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

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorflang:frontend

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @DanielCChen@klausler@llvmbot

    Issue actions

      [Flang] GENERIC INTERFACE: BINC(C) attribute not propagate to the generic name that is the same as the specific name that has the BIND(C) attribute. · Issue #82267 · llvm/llvm-project