[PATCH] D150960: [NFC] Fix uninitialized scalar variable found by Coverity static analyzer tool

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 19 04:26:16 PDT 2023


Manna created this revision.
Manna added a reviewer: zturner.
Herald added subscribers: manas, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, a.sidorin, baloghadamsoftware.
Herald added a project: All.
Manna requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Reported by Coverity Static Analyzer Tool:

  Inside "MicrosoftDemangle.cpp" file, in llvm::​ms_demangle::​Demangler::​demangleTemplateInstantiationName(std::​basic_string_view<char, std::​char_traits<char>> &, llvm::​ms_demangle::​NameBackrefBehavior): Use of an uninitialized value OuterContext. Field OuterContext.FunctionParams is uninitialized when calling swap in the function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150960

Files:
  llvm/include/llvm/Demangle/MicrosoftDemangle.h


Index: llvm/include/llvm/Demangle/MicrosoftDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/MicrosoftDemangle.h
+++ llvm/include/llvm/Demangle/MicrosoftDemangle.h
@@ -114,7 +114,7 @@
 struct BackrefContext {
   static constexpr size_t Max = 10;
 
-  TypeNode *FunctionParams[Max];
+  TypeNode *FunctionParams[Max] = nullptr;
   size_t FunctionParamCount = 0;
 
   // The first 10 BackReferences in a mangled name can be back-referenced by


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150960.523731.patch
Type: text/x-patch
Size: 500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230519/49bc726a/attachment-0001.bin>


More information about the cfe-commits mailing list