Keep the extended value when lowering optional assumed type
dummy argument. The extended value is needed to lower correctly the
rest of the code.
Reviewed By: PeteSteinfeld, jeanPerier
Differential Revision: https://reviews.llvm.org/D147575
const Fortran::evaluate::Symbol *assumedTypeSym =
arg.value()->GetAssumedTypeDummy();
auto symBox = symMap.lookupSymbol(*assumedTypeSym);
- operands.emplace_back(symBox.getAddr());
+ operands.emplace_back(
+ converter.getSymbolExtendedValue(*assumedTypeSym, &symMap));
continue;
}
if (!expr) {
! CHECK-SAME: %[[ARG0:.*]]: !fir.box<!fir.array<?xnone>> {fir.bindc_name = "a", fir.optional}) {
! CHECK: %{{.*}} = fir.is_present %[[ARG0]] : (!fir.box<!fir.array<?xnone>>) -> i1
+ subroutine assumed_type_lbound(a)
+ type(*), optional :: a(:,:)
+ print*,lbound(a,dim=1)
+ end subroutine
+
+! CHECK-LABEL: func.func @_QMassumed_type_testPassumed_type_lbound(
+! CHECK-SAME: %[[ARG0:.*]]: !fir.box<!fir.array<?x?xnone>> {fir.bindc_name = "a", fir.optional}) {
+! CHECK: %[[C1:.*]] = arith.constant 1 : i32
+! CHECK: %{{.*}} = fir.call @_FortranAioOutputInteger32(%{{.*}}, %[[C1]]) {{.*}} : (!fir.ref<i8>, i32) -> i1
+
end module