[PATCH] D133202: [Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type
Lin Yurong via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 2 11:04:02 PDT 2022
yronglin added inline comments.
================
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);
----------------
rjmccall wrote:
> 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.
+1
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