[clang] f1eac77 - [clang][bytecode] Check new builtins for integer types (#111801)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 01:24:05 PDT 2024


Author: Timm Baeder
Date: 2024-10-10T10:23:59+02:00
New Revision: f1eac7761704fa4e16c2619a84890baad380fdce

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

LOG: [clang][bytecode] Check new builtins for integer types (#111801)

These might also be called with vectors, but we don't support that.

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 7d811b7baea7ce..1765193f5bebbc 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -1287,6 +1287,11 @@ static bool interp__builtin_ia32_addcarry_subborrow(InterpState &S,
                                                     const InterpFrame *Frame,
                                                     const Function *Func,
                                                     const CallExpr *Call) {
+  if (!Call->getArg(0)->getType()->isIntegerType() ||
+      !Call->getArg(1)->getType()->isIntegerType() ||
+      !Call->getArg(2)->getType()->isIntegerType())
+    return false;
+
   unsigned BuiltinOp = Func->getBuiltinID();
   APSInt CarryIn = getAPSIntParam(Frame, 0);
   APSInt LHS = getAPSIntParam(Frame, 1);


        


More information about the cfe-commits mailing list