[all-commits] [llvm/llvm-project] ca4652: [flang] UBOUND() edge case: empty dimension

jeanPerier via All-commits all-commits at lists.llvm.org
Thu Mar 24 01:08:37 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ca46521a4d567ca808907d33a31b57d3097d34fa
      https://github.com/llvm/llvm-project/commit/ca46521a4d567ca808907d33a31b57d3097d34fa
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2022-03-24 (Thu, 24 Mar 2022)

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

  Log Message:
  -----------
  [flang] UBOUND() edge case: empty dimension

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).

Differential Revision: https://reviews.llvm.org/D122242




More information about the All-commits mailing list