[all-commits] [llvm/llvm-project] 9df99d: [flang] Fix MAXLOC/MINLOC when MASK is scalar .FALSE.

Pete Steinfeld via All-commits all-commits at lists.llvm.org
Wed Apr 27 14:52:27 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9df99d8ac22fe712259ce1a973fbc29c8362ab48
      https://github.com/llvm/llvm-project/commit/9df99d8ac22fe712259ce1a973fbc29c8362ab48
  Author: Peter Steinfeld <psteinfeld at nvidia.com>
  Date:   2022-04-27 (Wed, 27 Apr 2022)

  Changed paths:
    M flang/runtime/extrema.cpp
    M flang/unittests/Runtime/Reduction.cpp

  Log Message:
  -----------
  [flang] Fix MAXLOC/MINLOC when MASK is scalar .FALSE.

When passing a scalar .FALSE. as the MASK argument to MAXLOC, we were getting
bad memory references.  We were falling into the code intended when the MASK
argument was missing.

I fixed this by checking for a scalar MASK with a .FALSE. value and
setting the result to all zeroes in that case.  I also added tests for
MAXLOC and MINLOC with scalar values of .TRUE. and .FALSE. for the MASK
argument.

I also special cased situations where the MASK argument is a scalar with
a .TRUE. value and passed along a nullptr in such cases.

Along the way, I eliminated the unused "chars" argument from the constructor
for ExtremumLocAccumulator.

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




More information about the All-commits mailing list