[flang-commits] [PATCH] D122242: [flang] UBOUND() edge case: empty dimension

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Mar 22 11:00:07 PDT 2022


jeanPerier created this revision.
jeanPerier added a reviewer: klausler.
jeanPerier added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.

Similarly to LBOUND in https://reviews.llvm.org/D121488, UBOUND must
return zero for an empty dimension, no matter the specification
expression.

Add a GetUBOUND method to be used in expression rewrite that prevents
folding UBOUND to a bound specification expression if the extent is
not a compile time constant.

Fold the case where the extents is known to be zero (and also deal with
this case in LBOUND since we can and should to comply with constant
expression requirements).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122242

Files:
  flang/include/flang/Evaluate/shape.h
  flang/lib/Evaluate/check-expression.cpp
  flang/lib/Evaluate/fold-integer.cpp
  flang/lib/Evaluate/shape.cpp
  flang/lib/Semantics/runtime-type-info.cpp
  flang/test/Evaluate/folding08.f90
  flang/test/Evaluate/rewrite01.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122242.417340.patch
Type: text/x-patch
Size: 12340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220322/d58be995/attachment.bin>


More information about the flang-commits mailing list