[flang] Fix shape analysis of RESHAPE result
authorPeter Klausler <pklausler@nvidia.com>
Fri, 1 Apr 2022 23:01:04 +0000 (16:01 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Thu, 14 Apr 2022 19:07:48 +0000 (12:07 -0700)
commitd054959786eeec6311218efd857c0cca658b6f77
tree1ce08eb36c89738c1a53cd6e64a7e28ba9ad64be
parent5955a0f9375a8c0b134eeb4a8de5155dcce7c94f
[flang] Fix shape analysis of RESHAPE result

Shape analysis of RESHAPE(..., SHAPE=s) should of course return
the SHAPE= actual argument when it is constant; but when it is
not, its length is still known, and thus so is the rank of the
result of RESHAPE(), and shape analysis should at least return
a shape vector of the right length rather than a result that
makes the result appear to be a scalar, which can lead to some
bogus error messages.

Also, while here: rename a private GetShapeHelper::AsShape()
routine so that it can't be confused with the ones in the API
of shape.h.

Differential Revision: https://reviews.llvm.org/D123712
flang/include/flang/Evaluate/shape.h
flang/lib/Evaluate/intrinsics.cpp
flang/lib/Evaluate/shape.cpp
flang/test/Semantics/call03.f90