diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp --- a/flang/lib/Lower/ConvertExpr.cpp +++ b/flang/lib/Lower/ConvertExpr.cpp @@ -246,6 +246,15 @@ } } + /// Convert a ascii scalar literal CHARACTER to IR. (specialization) + ExtValue + genAsciiScalarLit(const Fortran::evaluate::Scalar> &value, + int64_t len) { + assert(value.size() == static_cast(len)); + return fir::factory::createStringLiteral(builder, getLoc(), value); + } + template ExtValue genval(const Fortran::evaluate::Constant> @@ -256,7 +265,9 @@ opt = con.GetScalarValue(); assert(opt.has_value() && "constant has no value"); if constexpr (TC == Fortran::common::TypeCategory::Character) { - TODO(getLoc(), "genval char constant"); + if constexpr (KIND == 1) + return genAsciiScalarLit(opt.value(), con.LEN()); + TODO(getLoc(), "genval for Character with KIND != 1"); } else { return genScalarLit(opt.value()); }