[clang] [Clang][Sema] Fix crash when a declaration shares the name of the size-specific `__sync` builtin (PR #246711)
Akash Manna via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 27 09:55:58 PST 2026
https://github.com/akash-manna-sky created https://github.com/llvm/llvm-project/pull/246711
Fixes #120083
`BuiltinAtomicOverloaded` found the size-specific builtin it rewrites a `__sync_*` call to by name lookup. A program may declare `static int __sync_lock_test_and_set_4(volatile int *, int);` without redeclaring the builtin, so the lookup returned that function, the call was rewritten to it and CodeGen asserted on the argument types.
The declaration now comes from `Sema::getBuiltinFunctionDecl`, which keeps the lookup result only if it is the builtin and otherwise declares the builtin outside any scope. `BuildBuiltinCallExpr` had the same lookup and uses it too.
Assisted-by: LLMs.
The server is unavailable at this time. Please wait a few minutes before you try again.
More information about the cfe-commits
mailing list