[all-commits] [llvm/llvm-project] 10b23a: [flang] Handle BINC(C) variables and add TODO for ...

Valentin Clement (バレンタイン クレメン) via All-commits all-commits at lists.llvm.org
Wed Jun 22 11:47:40 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 10b23ae880f9ee0188d7ee97b7fc25243aa0c854
  Author: Valentin Clement <clementval at gmail.com>
  Date:   2022-06-22 (Wed, 22 Jun 2022)

  Changed paths:
    M flang/lib/Lower/CallInterface.cpp
    M flang/lib/Lower/ConvertVariable.cpp
    M flang/lib/Lower/Mangler.cpp
    A flang/test/Lower/c-interoperability-bindc-variables.f90
    M flang/test/Lower/call-site-mangling.f90
    M flang/test/Lower/program-units-fir-mangling.f90

  Log Message:
  [flang] Handle BINC(C) variables and add TODO for corner cases

- BIND(C) was ignored in lowering for objects (it can be used on
module and common blocks): use the bind name as the fir.global name.

- When an procedure is declared BIND(C) indirectly via an interface,
  it should have a BIND(C) name. This was not the case because
  GetBindName()/bindingName() return nothing in this case: detect this
  case in mangler.cpp and use the symbol name.

Add TODOs for corner cases:

- BIND(C) module variables may be initialized on the C side. This does
  not fit well with the current linkage strategy. Add a TODO until this
  is revisited.

- BIND(C) internal procedures should not have a binding label (see
  Fortran 2018 section 18.10.2 point 2), yet we currently lower them as
  if they were BIND(C) external procedure.
  I think this and the indirect interface case should really be
  handled by symbol.GetBindName instead of adding more logic in
  lowering to deal with this case: add a TODO.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D128340

Co-authored-by: Jean Perier <jperier at nvidia.com>

More information about the All-commits mailing list