[flang] Support known constant lengths in DynamicType
authorpeter klausler <pklausler@nvidia.com>
Thu, 3 Jun 2021 00:13:55 +0000 (17:13 -0700)
committerpeter klausler <pklausler@nvidia.com>
Thu, 3 Jun 2021 21:25:22 +0000 (14:25 -0700)
commitac9641753bba836f2c22e0a2366b5233788d50b3
treee2e62a1078410f9c3acdaa0172ba233624d44cbe
parentd0ee8b64ecf359737ce550d8f47f465ab6657be7
[flang] Support known constant lengths in DynamicType

The constexpr-capable class evaluate::DynamicType represented
CHARACTER length only with a nullable pointer into the declared
parameters of types in the symbol table, which works fine for
anything with a declaration but turns out to not suffice to
describe the results of the ACHAR() and CHAR() intrinsic
functions.  So extend DynamicType to also accommodate known
constant CHARACTER lengths, too; use them for ACHAR & CHAR;
clean up several use sites and fix regressions found in test.

Differential Revision: https://reviews.llvm.org/D103571
13 files changed:
flang/include/flang/Evaluate/fold.h
flang/include/flang/Evaluate/type.h
flang/lib/Evaluate/characteristics.cpp
flang/lib/Evaluate/formatting.cpp
flang/lib/Evaluate/intrinsics.cpp
flang/lib/Evaluate/tools.cpp
flang/lib/Evaluate/type.cpp
flang/lib/Evaluate/variable.cpp
flang/lib/Semantics/expression.cpp
flang/lib/Semantics/scope.cpp
flang/test/Semantics/array-constr-values.f90
flang/test/Semantics/data02.f90
flang/test/Semantics/separate-mp02.f90