[PATCH] D122447: Prevent comparison with wider type in loop condition

Aakanksha Patil via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 24 18:36:10 PDT 2022


aakanksha555 created this revision.
aakanksha555 added reviewers: kzhuravl, rampitec, msearles.
Herald added a project: All.
aakanksha555 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This change fixes the code violations flagged in AMD compute CodeQL scan - "comparison-with-wider-type"


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122447

Files:
  llvm/utils/TableGen/X86RecognizableInstr.cpp


Index: llvm/utils/TableGen/X86RecognizableInstr.cpp
===================================================================
--- llvm/utils/TableGen/X86RecognizableInstr.cpp
+++ llvm/utils/TableGen/X86RecognizableInstr.cpp
@@ -840,7 +840,7 @@
 
     uint8_t currentOpcode;
 
-    for (currentOpcode = opcodeToSet; currentOpcode < opcodeToSet + Count;
+    for (currentOpcode = opcodeToSet; currentOpcode < (uint8_t)(opcodeToSet + Count);
          ++currentOpcode)
       tables.setTableFields(*opcodeType, insnContext(), currentOpcode, *filter,
                             UID, Is32Bit, OpPrefix == 0,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122447.418102.patch
Type: text/x-patch
Size: 599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220325/d8f662d6/attachment.bin>


More information about the llvm-commits mailing list