[llvm] [nsan] Fix `Wstring-conversion` error (PR #100328)

Dmitry Chestnykh via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 01:49:03 PDT 2024


https://github.com/chestnykh created https://github.com/llvm/llvm-project/pull/100328

Fix error: implicit conversion turns string literal into bool: 'const char[46]' to 'bool' [-Werror,-Wstring-conversion]

>From 04920888873369a1b6a8e9da2b3ec75b312157f3 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Wed, 24 Jul 2024 11:50:29 +0300
Subject: [PATCH] [nsan] Fix `Wstring-conversion` error

Fix error: implicit conversion turns string literal into bool:
'const char[46]' to 'bool' [-Werror,-Wstring-conversion]
---
 .../Transforms/Instrumentation/NumericalStabilitySanitizer.cpp  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
index 0b54f571f5508..1441d74cbf646 100644
--- a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
@@ -527,7 +527,7 @@ NsanMemOpFn::NsanMemOpFn(Module &M, ArrayRef<StringRef> Sized,
         M.getOrInsertFunction(Fallback, Attr, VoidTy, PtrTy, IntptrTy));
     SizedFnTy = FunctionType::get(VoidTy, {PtrTy}, false);
   } else {
-    assert(!"Unexpected value of sized functions arguments");
+    assert(0 && !"Unexpected value of sized functions arguments");
   }
 
   for (size_t i = 0; i < NumSizedFuncs; ++i)



More information about the llvm-commits mailing list