[flang] Fix the trivial type passed as value with bind(C)
authorPeixin Qiao <qiaopeixin@huawei.com>
Mon, 17 Oct 2022 15:27:17 +0000 (23:27 +0800)
committerPeixin Qiao <qiaopeixin@huawei.com>
Mon, 17 Oct 2022 15:27:17 +0000 (23:27 +0800)
commit205b47401ed6517cc34e473838e1d307715cc9a4
tree50c912c007393ed80e23585809ff8abf076a35a6
parent9f1f1b924f420f0bbbe605b27346d89177c8129a
[flang] Fix the trivial type passed as value with bind(C)

In the callee side, the value cannot be used directly. For example, the
dummy argument is lhs variable or the dummy argument is passed to
another procedure as actual argument.

Fix this by allocating one temporary storage and store the value. Then
map the symbol of dummy argument to the `mlir::Value` of the temporary.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D136009
flang/lib/Lower/Bridge.cpp
flang/lib/Lower/CallInterface.cpp
flang/test/Lower/call-by-value.f90
flang/test/Lower/call.f90