[clang] [clang][bytecode] Check new builtins for integer types (PR #111801)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 10 00:54:22 PDT 2024
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/111801
These might also be called with vectors, but we don't support that.
>From f04ea10e1fd1a42e7108f0dcf1575e4a51877d60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Thu, 10 Oct 2024 09:50:03 +0200
Subject: [PATCH] [clang][bytecode] Check new builtins for integer types
These might also be called with vectors, but we don't support that.
---
clang/lib/AST/ByteCode/InterpBuiltin.cpp | 5 +++++
1 file changed, 5 insertions(+)
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