[flang-commits] [PATCH] D123520: [flang] Fix UBOUND() folding for constant arrays
Jean Perier via Phabricator via flang-commits
flang-commits at lists.llvm.org
Tue Apr 19 05:18:41 PDT 2022
jeanPerier added a comment.
Other than my inlined comment about UBOUND of `(cst)`, this looks good.
================
Comment at: flang/lib/Evaluate/fold-integer.cpp:77
- template <typename T> ConstantSubscripts GetLbound(const Parentheses<T> &x) {
+ template <typename T> ConstantSubscripts Get(const Parentheses<T> &x) {
// LBOUND for (x) is [1, ..., 1] cause of temp variable inside
----------------
The UBOUND case if missing for the Parentheses<T> case (need to return the shape). You can probably use `GetConstantExtents` if you make the FoldingContext& available here, or you can set a flag that parentheses were met and return x.shape() in `Get(const Constant<T> &x)` in that case.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123520/new/
https://reviews.llvm.org/D123520
More information about the flang-commits
mailing list