[flang-commits] [flang] 14278aa - [flang][MSVC] Resolve warning message
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Sun Oct 30 11:21:23 PDT 2022
Author: Peter Klausler
Date: 2022-10-30T11:21:13-07:00
New Revision: 14278aa80b806a252d6abb1c50c98f978a4410e5
URL: https://github.com/llvm/llvm-project/commit/14278aa80b806a252d6abb1c50c98f978a4410e5
DIFF: https://github.com/llvm/llvm-project/commit/14278aa80b806a252d6abb1c50c98f978a4410e5.diff
LOG: [flang][MSVC] Resolve warning message
MSVC emits a warning on some recently patched code; fix it.
Added:
Modified:
flang/lib/Evaluate/fold-implementation.h
Removed:
################################################################################
diff --git a/flang/lib/Evaluate/fold-implementation.h b/flang/lib/Evaluate/fold-implementation.h
index 1a2ea1da4e15..5035e4630494 100644
--- a/flang/lib/Evaluate/fold-implementation.h
+++ b/flang/lib/Evaluate/fold-implementation.h
@@ -1607,7 +1607,6 @@ Expr<TO> FoldOperation(
TypeCategory constexpr FromCat{FROMCAT};
static_assert(FromCat == Operand::category);
auto &convert{msvcWorkaround.convert};
- char buffer[64];
if (auto value{GetScalarConstantValue<Operand>(kindExpr)}) {
FoldingContext &ctx{msvcWorkaround.context};
if constexpr (TO::category == TypeCategory::Integer) {
@@ -1636,6 +1635,7 @@ Expr<TO> FoldOperation(
if constexpr (FromCat == TypeCategory::Integer) {
auto converted{Scalar<TO>::FromInteger(*value)};
if (!converted.flags.empty()) {
+ char buffer[64];
std::snprintf(buffer, sizeof buffer,
"INTEGER(%d) to REAL(%d) conversion", Operand::kind,
TO::kind);
@@ -1644,6 +1644,7 @@ Expr<TO> FoldOperation(
return ScalarConstantToExpr(std::move(converted.value));
} else if constexpr (FromCat == TypeCategory::Real) {
auto converted{Scalar<TO>::Convert(*value)};
+ char buffer[64];
if (!converted.flags.empty()) {
std::snprintf(buffer, sizeof buffer,
"REAL(%d) to REAL(%d) conversion", Operand::kind, TO::kind);
More information about the flang-commits
mailing list