[all-commits] [llvm/llvm-project] 15da13: [flang] Add TODO for creation of polymorphic tempo...

jeanPerier via All-commits all-commits at lists.llvm.org
Mon Apr 3 00:23:03 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 15da136f091939357f0178f360da74547aa6145a
      https://github.com/llvm/llvm-project/commit/15da136f091939357f0178f360da74547aa6145a
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2023-04-03 (Mon, 03 Apr 2023)

  Changed paths:
    M flang/lib/Lower/ConvertExpr.cpp
    M flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
    M flang/test/HLFIR/as_expr-codegen.fir
    M flang/test/Lower/polymorphic.f90

  Log Message:
  -----------
  [flang] Add TODO for creation of polymorphic temporary

The current code is wrong: it is doing an alloca with the declared
type instead of the dynamic type, leading to undefined behavior
when the dynamic type and declared type differ and the temporary
is later used.
This also introduces some `fir.alloca none` for unlimited polymorphic that
are not allocating the right thing at all.

Add TODOs for now, the correct thing to do will probably be to use the
runtime (like AssignTemporary), but since this happens in code doing
"mold" temp allocation, I first need to check if there is a need for "mold"
temporary creation not followed by an assign, or if this can be combined
with the assign instead (for HLFIR, it is pretty easy combine this from as_expr
codegen, not sure for the current lowering).

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




More information about the All-commits mailing list