diff --git a/flang/lib/Evaluate/fold-integer.cpp b/flang/lib/Evaluate/fold-integer.cpp index c60648fb195f2..ba4bc6a04750f 100644 --- a/flang/lib/Evaluate/fold-integer.cpp +++ b/flang/lib/Evaluate/fold-integer.cpp @@ -697,7 +697,8 @@ Expr> FoldIntrinsicFunction( ScalarFunc( #ifndef _MSC_VER [&FromInt64](const Scalar &c) { - return FromInt64(CharacterUtils::ICHAR(c)); + return FromInt64(CharacterUtils::ICHAR( + CharacterUtils::Resize(c, 1))); })); #else // _MSC_VER // MSVC 14 get confused by the original code above and @@ -707,7 +708,8 @@ Expr> FoldIntrinsicFunction( // so remove the FromInt64 error checking lambda that // seems to have caused the proble. [](const Scalar &c) { - return CharacterUtils::ICHAR(c); + return CharacterUtils::ICHAR( + CharacterUtils::Resize(c, 1)); })); #endif // _MSC_VER },