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 passing extra information to determine if the MASK argument is
missing versus a scalar value. I also added tests for MAXLOC and MINLOC with
scalar values of .TRUE. and .FALSE. for the MASK argument.
Along the way, I eliminated the unused "chars" argument from the constructor
for ExtremumLocAccumulator.
It is really not straightforward to me how you can assume that mask_ is a scalar false here when the if is only testing for the presence of a MASK.
I assume this may come from the way GetResult() is called in flang/runtime/reduction-templates.h, but that is a big assumption.
Have you tried fixing the issue on the reduction-templates side that is calling GetResult ?