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

Raymond Tian via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 18 10:20:49 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();
----------------
raymondytian wrote:

We may want to check the parameters that do exist so we can do additional error checking on them.

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


More information about the cfe-commits mailing list