[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 07:01:58 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:

@klausler, the code here is to deal correctly with the case:
```
 interface
   subroutine iface() bind(c)
   end subroutine
 end interface
 procedure(iface) :: foo
 call foo()
end
```
foo has a binding label, but GetBindName() returns a nullptr. Ideally it should return a pointer to "foo".

I could not come to a solid confidence that we always have enough info already in name resolution to set this in SetBindNameOn, so I kept the special handling here in lowering where I am sure `procDetails->procInterface()` was set.

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


More information about the flang-commits mailing list