[PATCH] D150140: [NFC][CLANG] Fix Static Code Analysis Concerns

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 10 13:24:44 PDT 2023


Manna updated this revision to Diff 521089.
Manna added a comment.

Fix Coverity complain about shift overflow issue


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150140/new/

https://reviews.llvm.org/D150140

Files:
  clang/utils/TableGen/SveEmitter.cpp


Index: clang/utils/TableGen/SveEmitter.cpp
===================================================================
--- clang/utils/TableGen/SveEmitter.cpp
+++ clang/utils/TableGen/SveEmitter.cpp
@@ -299,6 +299,7 @@
     if (It != FlagTypes.end()) {
       uint64_t Mask = It->getValue();
       unsigned Shift = llvm::countr_zero(Mask);
+      assert(Shift < 64 && "Mask value produced an invalid shift value");
       return (V << Shift) & Mask;
     }
     llvm_unreachable("Unsupported flag");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150140.521089.patch
Type: text/x-patch
Size: 493 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230510/b8878d3a/attachment.bin>


More information about the cfe-commits mailing list