[flang-commits] [flang] [flang] Fix character length checking in ALLOCATE (PR #163657)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Thu Oct 16 08:39:55 PDT 2025
================
@@ -439,7 +439,7 @@ static bool HaveCompatibleLengths(
evaluate::ToInt64(type1.characterTypeSpec().length().GetExplicit())};
auto v2{
evaluate::ToInt64(type2.characterTypeSpec().length().GetExplicit())};
- return !v1 || !v2 || *v1 == *v2;
+ return !v1 || !v2 || (*v1 >= 0 ? *v1 : 0) == (*v2 >= 0 ? *v2 : 0);
----------------
klausler wrote:
`std::max()` has typing restrictions that end up making it wordy in practice, so I typically don't use it.
https://github.com/llvm/llvm-project/pull/163657
More information about the flang-commits
mailing list