[flang] Fix function result rewrite
authorPeixin Qiao <qiaopeixin@huawei.com>
Fri, 4 Nov 2022 14:15:58 +0000 (22:15 +0800)
committerPeixin Qiao <qiaopeixin@huawei.com>
Fri, 4 Nov 2022 14:15:58 +0000 (22:15 +0800)
commit749242668885d86a4f8bd6a5e697250b6cdb36d3
tree9d4001807d4561bec9a99872676368e61917f25d
parent4b604cc27e28a0edcb22a5ae5f29b8ff3bd0eacf
[flang] Fix function result rewrite

When the function result is `type(c_ptr/c_funptr)`, and the function has
or does not have BIND(C) attribute, the function result is not taken as
the first argument of the function call in other compilers such as
gfortran and ifort. Fix it to be consistent with gfortran/ifort by
changing the abstract result type check.

Fix #58739.

Reviewed By: PeteSteinfeld, jeanPerier

Differential Revision: https://reviews.llvm.org/D137236
flang/lib/Optimizer/Dialect/FIRType.cpp
flang/test/Fir/abstract-results.fir