[flang-commits] [flang] 6164d36 - [flang] Keep the extended value for assumed-type optional
Valentin Clement via flang-commits
flang-commits at lists.llvm.org
Wed Apr 5 13:35:30 PDT 2023
Author: Valentin Clement
Date: 2023-04-05T13:35:24-07:00
New Revision: 6164d363e3d99442f7f1fd81d11b97e979684e2f
URL: https://github.com/llvm/llvm-project/commit/6164d363e3d99442f7f1fd81d11b97e979684e2f
DIFF: https://github.com/llvm/llvm-project/commit/6164d363e3d99442f7f1fd81d11b97e979684e2f.diff
LOG: [flang] Keep the extended value for assumed-type optional
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
Added:
Modified:
flang/lib/Lower/ConvertExpr.cpp
flang/test/Lower/assumed-type.f90
Removed:
################################################################################
diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp
index c06fcc24e7c22..f6a6e7002feff 100644
--- a/flang/lib/Lower/ConvertExpr.cpp
+++ b/flang/lib/Lower/ConvertExpr.cpp
@@ -1844,7 +1844,8 @@ class ScalarExprLowering {
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) {
diff --git a/flang/test/Lower/assumed-type.f90 b/flang/test/Lower/assumed-type.f90
index 856129d424f8e..c050779e73086 100644
--- a/flang/test/Lower/assumed-type.f90
+++ b/flang/test/Lower/assumed-type.f90
@@ -48,4 +48,14 @@ subroutine assumed_type_optional_to_intrinsic(a)
! 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
More information about the flang-commits
mailing list