Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flang] Missing diagnose on multiple proc-decl when Binding NAME= is present #82528

Closed
DanielCChen opened this issue Feb 21, 2024 · 4 comments · Fixed by #82842
Closed

[Flang] Missing diagnose on multiple proc-decl when Binding NAME= is present #82528

DanielCChen opened this issue Feb 21, 2024 · 4 comments · Fixed by #82842
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior flang:frontend

Comments

@DanielCChen
Copy link
Contributor

Consider the following code:

   interface
      subroutine foo() BIND(C)
      end subroutine
   end interface

   procedure(foo), BIND(C, NAME='myfptr') :: p1, p2, p3
   end

Flang currently compiles it successfully, but it violates the following constraint

C1520 (R1512) If proc-language-binding-spec with NAME= is specified, then proc-decl-list shall contain exactly
21 one proc-decl, which shall neither have the POINTER attribute nor be a dummy procedure.
@DanielCChen DanielCChen added bug Indicates an unexpected problem or unintended behavior flang:frontend labels Feb 21, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 21, 2024

@llvm/issue-subscribers-bug

Author: Daniel Chen (DanielCChen)

Consider the following code: ``` interface subroutine foo() BIND(C) end subroutine end interface

procedure(foo), BIND(C, NAME='myfptr') :: p1, p2, p3
end

Flang currently compiles it successfully, but it violates the following constraint 

C1520 (R1512) If proc-language-binding-spec with NAME= is specified, then proc-decl-list shall contain exactly
21 one proc-decl, which shall neither have the POINTER attribute nor be a dummy procedure.

</details>

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 21, 2024

@llvm/issue-subscribers-flang-frontend

Author: Daniel Chen (DanielCChen)

Consider the following code: ``` interface subroutine foo() BIND(C) end subroutine end interface

procedure(foo), BIND(C, NAME='myfptr') :: p1, p2, p3
end

Flang currently compiles it successfully, but it violates the following constraint 

C1520 (R1512) If proc-language-binding-spec with NAME= is specified, then proc-decl-list shall contain exactly
21 one proc-decl, which shall neither have the POINTER attribute nor be a dummy procedure.

</details>

klausler added a commit to klausler/llvm-project that referenced this issue Feb 23, 2024
When a procedure declaration statement has a binding label,
it must declare no more than one procedure.

Fixes llvm#82528.
@klausler
Copy link
Contributor

#82842

@klausler klausler self-assigned this Feb 23, 2024
@DanielCChen
Copy link
Contributor Author

I have verified PR #82842 fixed the issue. Flang now issues

A procedure declaration statement with a binding name may not declare multiple procedures
     procedure(foo), BIND(C, NAME='myfptr') :: p1, p2, p3
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Thanks for the quick fix! @klausler

klausler added a commit that referenced this issue Mar 2, 2024
When a procedure declaration statement has a binding label, it must
declare no more than one procedure.

Fixes #82528.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior flang:frontend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants