[PATCH] D143813: [ClangFE] Check that __sync builtins are naturally aligned.
Jonas Paulsson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 11 06:29:38 PDT 2023
jonpa added a comment.
In D143813#4256969 <https://reviews.llvm.org/D143813#4256969>, @ahatanak wrote:
> I think this patch is causing the assertion in `CodeGenFunction::setAddrOfLocalVar` to fail when the following code is compiled:
>
> void foo(unsigned long long t) {
> __sync_bool_compare_and_swap(({int x = 1; &t;}), t, t);
> }
>
> Could you take a look?
I don't understand the first argument - I thought it was supposed to be just an address...
This patch seems to (in CheckAtomicAlignment()) call CGF.EmitPointerWithAlignment() on the CompoundStmt, which is unexpected. If this is a legal parameter for the address, I guess there should be some kind of special handling here. Perhaps it would be ok to only emit the warning for plain address paramters, I might think...?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143813/new/
https://reviews.llvm.org/D143813
More information about the cfe-commits
mailing list