[all-commits] [llvm/llvm-project] f9fdd4: [flang] Don't emit false errors on LBOUND/UBOUND o...

Peter Klausler via All-commits all-commits at lists.llvm.org
Tue Aug 1 11:03:24 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f9fdd4fdbafbae7e6bc0ad2dd29b9ebb484fef11
      https://github.com/llvm/llvm-project/commit/f9fdd4fdbafbae7e6bc0ad2dd29b9ebb484fef11
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2023-08-01 (Tue, 01 Aug 2023)

  Changed paths:
    M flang/lib/Evaluate/fold-integer.cpp
    M flang/test/Evaluate/errors01.f90

  Log Message:
  -----------
  [flang] Don't emit false errors on LBOUND/UBOUND of assumed-rank arrays

Folding of LBOUND/UBOUND on assumed-rank arrays could lead to bogus errors
later.  This is a regression from a recent change intended to ensure that
patently bad DIM= arguments were caught even in the case of assumed-rank.
Rearrange the order of checks so that those bad DIM= argument values are
caught but otherwise defer LBOUND/UBOUND of assumed-rank arguments to
run time.  (It was tempting to always fold LBOUND(ar,DIM=n) to 1, but
that would obscure the run time error required when 'n' is out of bounds,
including the case of a scalar 'ar'.)

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




More information about the All-commits mailing list