[flang-commits] [flang] [flang] Lower special bind(c) cases without binding labels (PR #65758)

via flang-commits flang-commits at lists.llvm.org
Fri Sep 8 08:59:06 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{
----------------
jeanPerier wrote:

> We should probably check that a BIND(C,NAME='...') suffix on an external procedure interface declaration (with an explicit name) doesn't exist when the interface is used in a procedure-declaration-stmt that isn't a pointer -- there's nothing in the standard about that case, but it would lead to trouble.

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
```

> 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?

https://github.com/llvm/llvm-project/pull/65758


More information about the flang-commits mailing list