[clang] [HIP][Clang][Sema] Fix crash when calling builtins with pointer arguments (PR #95957)

Shilei Tian via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 18 10:16:56 PDT 2024


================
@@ -6628,7 +6628,8 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
     // the parameter type.
     if (getLangOpts().HIP && getLangOpts().CUDAIsDevice && FD &&
         FD->getBuiltinID()) {
-      for (unsigned Idx = 0; Idx < FD->param_size(); ++Idx) {
+      for (unsigned Idx = 0; Idx < ArgExprs.size() && Idx < FD->param_size();
----------------
shiltian wrote:

We might want to bail out early if the size doesn't match.

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


More information about the cfe-commits mailing list