[flang-commits] [PATCH] D147333: [flang] Add TODO for creation of polymorphic temporary
Jean Perier via Phabricator via flang-commits
flang-commits at lists.llvm.org
Fri Mar 31 08:20:44 PDT 2023
jeanPerier created this revision.
jeanPerier added reviewers: PeteSteinfeld, clementval.
jeanPerier added a project: Flang.
Herald added subscribers: sunshaoce, mehdi_amini, jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.
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).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147333
Files:
flang/lib/Lower/ConvertExpr.cpp
flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
flang/test/HLFIR/as_expr-codegen.fir
flang/test/Lower/polymorphic.f90
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147333.510046.patch
Type: text/x-patch
Size: 8041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230331/3de12069/attachment.bin>
More information about the flang-commits
mailing list