[flang-commits] [flang] [flang] Add hlfir.index op to represent index intrinsic function (PR #157575)
via flang-commits
flang-commits at lists.llvm.org
Tue Sep 9 02:17:11 PDT 2025
================
@@ -3039,6 +3044,38 @@ hlfir::Entity Fortran::lower::PreparedActualArgument::getActual(
return hlfir::Entity{addr};
}
+mlir::Value Fortran::lower::PreparedActualArgument::getOptionalValue(
+ mlir::Location loc, fir::FirOpBuilder &builder) const {
+ mlir::Type eleType;
+ if (auto *actualEntity = std::get_if<hlfir::Entity>(&actual))
+ eleType = hlfir::getFortranElementType(actualEntity->getType());
+ else
+ TODO(loc, "compute element type from hlfir::ElementalAddrOp");
----------------
jeanPerier wrote:
This case is impossible assuming this is always done under `arg->handleDynamicOptional()` because a vector subscript argument is present not the whole component or name of a POINTER, ALLOCATABLE, or OPTIONAL. So the argument created from it is always present. It is not valid to vector subscript an unallocated ALLOCATABLE/disassociated POINTER/absent OPTIONAL, even when passing it to an OPTIONAL argument.
https://github.com/llvm/llvm-project/pull/157575
More information about the flang-commits
mailing list