[flang] Fix the interface for numerical/logical scalar with VALUE attribute
authorPeixin Qiao <qiaopeixin@huawei.com>
Sat, 22 Oct 2022 01:15:02 +0000 (09:15 +0800)
committerPeixin Qiao <qiaopeixin@huawei.com>
Sat, 22 Oct 2022 01:15:02 +0000 (09:15 +0800)
commitd3c0dd6e4d7783a45f66f544ed0934dc8adaa933
tree3d6c8b0b363d44b71c27a9262fa0463ef2fc165c
parent6c07bda7a75c68aa14a1e5f1ca0eac9ba6220cbb
[flang] Fix the interface for numerical/logical scalar with VALUE attribute

Programmers may use procedure without BIND(C) attribute to interoperate
with C code. For numerical/logical scalar with VALUE attribute, pass the
argument by value so that the behavior is consistent with gfortran or
nvfortran. The argument with the OPTIONAL attribute cannot be passed by
value since the actual argument may be absent.

For the derived type, pass-by-value is not supported yet, so pass the
argument by reference for now.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D136260
flang/lib/Lower/CallInterface.cpp
flang/test/Lower/array-elemental-calls-2.f90
flang/test/Lower/array-elemental-calls.f90
flang/test/Lower/array-elemental-subroutines.f90
flang/test/Lower/array-expression.f90
flang/test/Lower/call-by-value-attr.f90