[clang] 5405ba5 - [clang][bytecode] Check ia32_{pext,pdep} builtins for integer args (#113091)

via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 20 10:37:45 PDT 2024


Author: Timm Baeder
Date: 2024-10-20T19:37:41+02:00
New Revision: 5405ba50de6753e3969f4e6c690f53f2abb29b2f

URL: https://github.com/llvm/llvm-project/commit/5405ba50de6753e3969f4e6c690f53f2abb29b2f
DIFF: https://github.com/llvm/llvm-project/commit/5405ba50de6753e3969f4e6c690f53f2abb29b2f.diff

LOG: [clang][bytecode] Check ia32_{pext,pdep} builtins for integer args (#113091)

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/InterpBuiltin.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index d4a8e6c2035ee5..c7b9dac5fec80c 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -1331,6 +1331,10 @@ static bool interp__builtin_ia32_pdep(InterpState &S, CodePtr OpPC,
                                       const InterpFrame *Frame,
                                       const Function *Func,
                                       const CallExpr *Call) {
+  if (!Call->getArg(0)->getType()->isIntegerType() ||
+      !Call->getArg(1)->getType()->isIntegerType())
+    return false;
+
   PrimType ValT = *S.Ctx.classify(Call->getArg(0));
   PrimType MaskT = *S.Ctx.classify(Call->getArg(1));
 
@@ -1352,6 +1356,10 @@ static bool interp__builtin_ia32_pext(InterpState &S, CodePtr OpPC,
                                       const InterpFrame *Frame,
                                       const Function *Func,
                                       const CallExpr *Call) {
+  if (!Call->getArg(0)->getType()->isIntegerType() ||
+      !Call->getArg(1)->getType()->isIntegerType())
+    return false;
+
   PrimType ValT = *S.Ctx.classify(Call->getArg(0));
   PrimType MaskT = *S.Ctx.classify(Call->getArg(1));
 


        


More information about the cfe-commits mailing list