[flang] Support C1553 about BIND(C) function result
authorPeixin Qiao <qiaopeixin@huawei.com>
Wed, 11 Jan 2023 12:55:15 +0000 (20:55 +0800)
committerPeixin Qiao <qiaopeixin@huawei.com>
Wed, 11 Jan 2023 12:55:15 +0000 (20:55 +0800)
commit2d6e280223cca4e44882245feb06e0c50d4c6375
tree9486272dcc652b06ec5e89c2bcd888be30d6dbf7
parent800f0f1546b2352ba42a4777149afb13cb874fcd
[flang] Support C1553 about BIND(C) function result

As Fortran 2018 C1553, if with BIND(C), the function result shall be an
interoperable scalar variable. As Fortran 2018 18.3.4(1), the
interoperable scalar variable is not a coarray, has neither the
ALLOCATABLE nor the POINTER attribute, and if it is of type character its
length is not assumed or declared by an expression that is not a constant
expression.

As Fortran 2018 18.3.1(1), if the type is character, the length type
parameter is interoperable if and only if its value is one.

Reviewed By: PeteSteinfeld, jeanPerier

Differential Revision: https://reviews.llvm.org/D137254
flang/lib/Semantics/check-declarations.cpp
flang/test/Semantics/bind-c09.f90 [new file with mode: 0644]