[llvm] 5a285bd - [LLVM][TableGen] Read from uninitialised variable (#66889)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 01:45:51 PDT 2023


Author: Tomáš Zeman
Date: 2023-09-25T10:45:47+02:00
New Revision: 5a285bd3258e35ddc65ac82453eab953c2fff1ff

URL: https://github.com/llvm/llvm-project/commit/5a285bd3258e35ddc65ac82453eab953c2fff1ff
DIFF: https://github.com/llvm/llvm-project/commit/5a285bd3258e35ddc65ac82453eab953c2fff1ff.diff

LOG: [LLVM][TableGen] Read from uninitialised variable (#66889)

Fixing an issue found in a UBsan build. When defining a variable-length
encoding with no operands or slices, the HasDynamicSegment member was
read without being initialised.

Added: 
    

Modified: 
    llvm/utils/TableGen/VarLenCodeEmitterGen.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/VarLenCodeEmitterGen.cpp b/llvm/utils/TableGen/VarLenCodeEmitterGen.cpp
index 85da547d04c1336..7a24030e17d8a82 100644
--- a/llvm/utils/TableGen/VarLenCodeEmitterGen.cpp
+++ b/llvm/utils/TableGen/VarLenCodeEmitterGen.cpp
@@ -114,7 +114,7 @@ static std::pair<StringRef, StringRef> getCustomCoders(ArrayRef<Init *> Args) {
 }
 
 VarLenInst::VarLenInst(const DagInit *DI, const RecordVal *TheDef)
-    : TheDef(TheDef), NumBits(0U) {
+    : TheDef(TheDef), NumBits(0U), HasDynamicSegment(false) {
   buildRec(DI);
   for (const auto &S : Segments)
     NumBits += S.BitWidth;


        


More information about the llvm-commits mailing list