From 04920888873369a1b6a8e9da2b3ec75b312157f3 Mon Sep 17 00:00:00 2001 From: Dmitry Chestnykh Date: Wed, 24 Jul 2024 11:50:29 +0300 Subject: [PATCH 1/3] [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 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) From 9f48fcd9d6991102acd322226cda2535693f3537 Mon Sep 17 00:00:00 2001 From: Dmitry Chestnykh Date: Wed, 24 Jul 2024 11:51:55 +0300 Subject: [PATCH 2/3] [nsan] Remove unneeded '!' --- .../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 1441d74cbf646..c3f9f61454eaa 100644 --- a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp @@ -527,7 +527,7 @@ NsanMemOpFn::NsanMemOpFn(Module &M, ArrayRef Sized, M.getOrInsertFunction(Fallback, Attr, VoidTy, PtrTy, IntptrTy)); SizedFnTy = FunctionType::get(VoidTy, {PtrTy}, false); } else { - assert(0 && !"Unexpected value of sized functions arguments"); + assert(0 && "Unexpected value of sized functions arguments"); } for (size_t i = 0; i < NumSizedFuncs; ++i) From 91eee5b1862716cb56ac3d3397d7027e66859979 Mon Sep 17 00:00:00 2001 From: Dmitry Chestnykh Date: Wed, 24 Jul 2024 11:55:38 +0300 Subject: [PATCH 3/3] [nsan] Use 'llvm_unreachable' instead of `assert` --- .../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 c3f9f61454eaa..b382fedde027b 100644 --- a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp @@ -527,7 +527,7 @@ NsanMemOpFn::NsanMemOpFn(Module &M, ArrayRef Sized, M.getOrInsertFunction(Fallback, Attr, VoidTy, PtrTy, IntptrTy)); SizedFnTy = FunctionType::get(VoidTy, {PtrTy}, false); } else { - assert(0 && "Unexpected value of sized functions arguments"); + llvm_unreachable("Unexpected value of sized functions arguments"); } for (size_t i = 0; i < NumSizedFuncs; ++i)