[flang-commits] [PATCH] D123520: [flang] Fix UBOUND() folding for constant arrays

Mike K via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Apr 19 06:03:14 PDT 2022


FruitClover added inline comments.


================
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
----------------
jeanPerier wrote:
> 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.
It's very next PR in sequence (Revision Contents -> Stack) - https://reviews.llvm.org/D123944, could combine into 1 patch if that's better. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123520/new/

https://reviews.llvm.org/D123520



More information about the flang-commits mailing list