diff --git a/flang/lib/Lower/IntrinsicCall.cpp b/flang/lib/Lower/IntrinsicCall.cpp index c9aa91b2b6c5f..9d2094c5c1cd1 100644 --- a/flang/lib/Lower/IntrinsicCall.cpp +++ b/flang/lib/Lower/IntrinsicCall.cpp @@ -4063,7 +4063,7 @@ static mlir::Value createExtremumCompare(mlir::Location loc, } else if (fir::isa_integer(type)) { result = builder.create(loc, integerPredicate, left, right); - } else if (fir::isa_char(type)) { + } else if (fir::isa_char(type) || fir::isa_char(fir::unwrapRefType(type))) { // TODO: ! character min and max is tricky because the result // length is the length of the longest argument! // So we may need a temp.