[PATCH] D133202: [Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 2 10:20:36 PDT 2022


rjmccall added a comment.

Other than the one thing, this looks good.



================
Comment at: clang/lib/Sema/SemaChecking.cpp:7697
   // The alignment must be a constant integer.
-  Expr *Arg = TheCall->getArg(1);
+  Expr *SecondArg = TheCall->getArg(1);
 
----------------
This should be:

```
Expr *SecondArg = TheCall->getArg(1);
if (convertArgumentToType(*this, SecondArg, Context.getSizeType()))
  return true;
TheCall->setArg(1, SecondArg);

if (!SecondArg->isValueDependent()) {
  llvm::APSInt Result;
  ....
}
```

Test case is to pass a floating-point expression or something like that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133202/new/

https://reviews.llvm.org/D133202



More information about the cfe-commits mailing list