[flang] Allow array constructor implied DO loop indices as constant expressions
authorpeter klausler <pklausler@nvidia.com>
Fri, 30 Oct 2020 19:57:28 +0000 (12:57 -0700)
committerpeter klausler <pklausler@nvidia.com>
Mon, 2 Nov 2020 19:00:17 +0000 (11:00 -0800)
commite8f96899e17b11292940d8826338e2e0a64a22b9
tree77d2d3be4417fb433cf87d05364476ab0499890a
parent9081e7594df2356f72c038423a0f8130f140b255
[flang] Allow array constructor implied DO loop indices as constant expressions

When the bounds of an implied DO loop in an array constructor are
constant, the index variable of that loop is considered a constant
expression and can be used as such in the items in the value list
of the implied DO loop.  Since the KIND type parameter values of items
in the value list can depend on the various values taken by such an
index, it is not possible to represent those values with a single
typed expression.  So implement such loops by taking multiple passes
over the parse tree of the implied DO loop instead.

Differential revision: https://reviews.llvm.org/D90494
flang/include/flang/Parser/message.h
flang/include/flang/Semantics/expression.h
flang/lib/Semantics/expression.cpp
flang/test/Evaluate/folding13.f90 [new file with mode: 0644]
flang/test/Semantics/array-constr-values.f90