[flang-commits] [flang] [Flang] Allow Intrinsic simpification with min/maxloc dim and scalar result (PR #81619)

David Green via flang-commits flang-commits at lists.llvm.org
Tue Feb 27 07:25:47 PST 2024


davemgreen wrote:

> So far as I can tell, the standard does not say what should happen for an invalid DIM index, so I suppose this is fine so long as there's a tangible benefit to skipping this check. @psteinfeld do you have an opinion on this?
> 
> Are you skipping this check for performance, or is this just because there isn't a convenient way to output an error message and exit from FIR?

Thanks - It just doesn't naturally check at runtime. Constants should be checked at compile time, as far as I understand. It will be the variable case from https://godbolt.org/z/f86YE1WeM that might not be diagnosed. (I had noticed that gfortran does the same thing, assuming that the dim will be a correct value).

I can add a check at compile time that the dim is a constant and the correct value if that would be more preferable.

https://github.com/llvm/llvm-project/pull/81619


More information about the flang-commits mailing list