[flang] Fix folding of LEN(f(...))
authorPeter Klausler <pklausler@nvidia.com>
Thu, 16 Jun 2022 18:41:09 +0000 (11:41 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Wed, 29 Jun 2022 17:25:07 +0000 (10:25 -0700)
commitb70f507c75ac327eba895a970b507467a325f03b
treef1fed384ba82d241aa05339ae58c2e3020739066
parenta9bef0707db101bb72d000a1f09686d97fb2d35d
[flang] Fix folding of LEN(f(...))

LEN(f(...)), where "f" is a non-intrinsic function, should not be folded
to anything else unless the result is a known constant value.  While there
are conceivable cases in which we could do better (e.g., an internal function
whose length is a host-associated INTENT(IN) dummy argument), there are
other cases that we're getting wrong.

Differential Revision: https://reviews.llvm.org/D128759
flang/lib/Evaluate/call.cpp
flang/lib/Evaluate/variable.cpp
flang/test/Evaluate/rewrite01.f90