diff --git a/flang/lib/Optimizer/Dialect/FIRType.cpp b/flang/lib/Optimizer/Dialect/FIRType.cpp --- a/flang/lib/Optimizer/Dialect/FIRType.cpp +++ b/flang/lib/Optimizer/Dialect/FIRType.cpp @@ -498,7 +498,7 @@ mlir::Type eleTy) { if (eleTy.isa()) + mlir::FloatType, fir::CharacterType>()) return mlir::success(); return emitError() << "invalid element type\n"; } diff --git a/flang/test/Lower/polymorphic.f90 b/flang/test/Lower/polymorphic.f90 --- a/flang/test/Lower/polymorphic.f90 +++ b/flang/test/Lower/polymorphic.f90 @@ -219,4 +219,18 @@ ! CHECK: %[[EMBOX:.*]] = fir.embox %[[TEMP]] tdesc %[[TDESC]] : (!fir.ref>, !fir.tdesc) -> !fir.class> ! CHECK: fir.call @_QMpolymorphic_testPtakes_p1(%[[EMBOX]]) {{.*}} : (!fir.class>) -> () + subroutine up_input(a) + class(*), intent(in) :: a + end subroutine + + subroutine pass_char_to_up() + call up_input('hello') + end subroutine + +! CHECK-LABEL: func.func @_QMpolymorphic_testPpass_char_to_up() { +! CHECK: %[[CHAR:.*]] = fir.address_of(@_QQcl.{{.*}}) : !fir.ref> +! CHECK: %[[EMBOX:.*]] = fir.embox %[[CHAR]] : (!fir.ref>) -> !fir.class> +! CHECK: %[[CONVERT:.*]] = fir.convert %[[EMBOX]] : (!fir.class>) -> !fir.class +! CHECK: fir.call @_QMpolymorphic_testPup_input(%[[CONVERT]]) {{.*}} : (!fir.class) -> () + end module