Skip to content

[flang] Fix handling of shadowed procedure name used as interface #82837

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

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions flang/lib/Semantics/resolve-names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5647,10 +5647,8 @@ void DeclarationVisitor::Post(const parser::ProcInterface &x) {
void DeclarationVisitor::Post(const parser::ProcDecl &x) {
const auto &name{std::get<parser::Name>(x.t)};
const Symbol *procInterface{nullptr};
if (interfaceName_) {
procInterface = interfaceName_->symbol->has<GenericDetails>()
? interfaceName_->symbol->get<GenericDetails>().specific()
: interfaceName_->symbol;
if (interfaceName_ && interfaceName_->symbol) {
procInterface = &BypassGeneric(*interfaceName_->symbol);
}
auto attrs{HandleSaveName(name.source, GetAttrs())};
DerivedTypeDetails *dtDetails{nullptr};
Expand Down
6 changes: 6 additions & 0 deletions flang/test/Semantics/bind-c03.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ subroutine proc2()
end
end interface

interface proc3
subroutine proc3() bind(c)
end
end interface

procedure(proc1), bind(c) :: pc1 ! no error
procedure(proc3), bind(c) :: pc4 ! no error

!ERROR: An interface name with BIND attribute must be specified if the BIND attribute is specified in a procedure declaration statement
procedure(proc2), bind(c) :: pc2
Expand Down