[flang-commits] [flang] [flang][semantics] fix IsConstantExpr for intrinsic with optional argument (PR #161915)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Fri Oct 3 15:02:08 PDT 2025
================
@@ -135,16 +135,21 @@ bool IsConstantExprHelper<INVARIANT>::operator()(
} else if (proc.IsPure()) {
std::size_t j{0};
for (const auto &arg : call.arguments()) {
- if (const auto *dataDummy{j < proc.dummyArguments.size()
- ? std::get_if<characteristics::DummyDataObject>(
- &proc.dummyArguments[j].u)
- : nullptr};
- dataDummy &&
+ const auto *dataDummy{j < proc.dummyArguments.size()
+ ? std::get_if<characteristics::DummyDataObject>(
+ &proc.dummyArguments[j].u)
+ : nullptr};
+ if (dataDummy &&
dataDummy->attrs.test(
characteristics::DummyDataObject::Attr::OnlyIntrinsicInquiry)) {
// The value of the argument doesn't matter
} else if (!arg) {
- return false;
+ // Missing optional arguments are constant
+ if (!(dataDummy &&
----------------
klausler wrote:
Shouldn't this be `if (!dataDummy && ...) {`?
https://github.com/llvm/llvm-project/pull/161915
More information about the flang-commits
mailing list