[flang-commits] [flang] [flang] Lower special bind(c) cases without binding labels (PR #65758)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Fri Sep 8 09:13:04 PDT 2023
================
@@ -99,11 +99,14 @@ Fortran::lower::mangle::mangleName(const Fortran::semantics::Symbol &symbol,
// TODO: A procedure that inherits BIND(C) through another interface
// (procedure(iface)) should be dealt with in GetBindName() or some wrapper.
- if (!Fortran::semantics::IsPointer(ultimateSymbol) &&
- Fortran::semantics::IsBindCProcedure(ultimateSymbol) &&
- Fortran::semantics::ClassifyProcedure(symbol) !=
- Fortran::semantics::ProcedureDefinitionClass::Internal)
- return ultimateSymbol.name().ToString();
+ if (const auto *procDetails{
----------------
klausler wrote:
> Do you mean that the following should be forbidden?
>
> ```
> interface
> subroutine iface() bind(c, "some_c_name")
> end subroutine
> end interface
> procedure(iface) :: foo
> call foo()
> end
> ```
What would it mean? Does it make 'foo' an alias for 'iface', using the same binding label? Does it mean that `foo` has the `BIND(C)` attribute with no explicit binding label? The standard doesn't say.
> > You could call SetBindNameOn(symbol) on foo as part of procedure-declaration-stmt name resolution
>
> So you think we can already call `Fortran::semantics::IsBindCProcedure(symbol)`instead of using `attrs_->test(Attr::BIND_C)` in SetBindNameOn?
Why would you want to make that change?
Also - a procedure-declaration-stmt *does* allow a `BIND(C[,NAME=...])` attribute -- I didn't notice it in the syntax because it was indirected. So now we have to worry about the interpretation of having `BIND(C)` on the explicit interface declaration and on the procedure-declaration-stmt.
https://github.com/llvm/llvm-project/pull/65758
More information about the flang-commits
mailing list