[clang] [clang][bytecode] Check number of addcarry/subborrow args (PR #111952)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 22:44:44 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

Apparently this can fail as well.

---
Full diff: https://github.com/llvm/llvm-project/pull/111952.diff


1 Files Affected:

- (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+1-1) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 1765193f5bebbc..74e9e1cf629372 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -1287,7 +1287,7 @@ static bool interp__builtin_ia32_addcarry_subborrow(InterpState &S,
                                                     const InterpFrame *Frame,
                                                     const Function *Func,
                                                     const CallExpr *Call) {
-  if (!Call->getArg(0)->getType()->isIntegerType() ||
+  if (Call->getNumArgs() != 4 || !Call->getArg(0)->getType()->isIntegerType() ||
       !Call->getArg(1)->getType()->isIntegerType() ||
       !Call->getArg(2)->getType()->isIntegerType())
     return false;

``````````

</details>


https://github.com/llvm/llvm-project/pull/111952


More information about the cfe-commits mailing list