[clang] [Clang] Permit floating point values in atomic_*_n operations (PR #183843)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 3 11:52:26 PST 2026
================
@@ -4894,10 +4894,14 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
diag::err_incomplete_type)) {
return ExprError();
}
- } else if (IsN && !ValType->isIntegerType() && !ValType->isPointerType()) {
+ } else if (IsN && !ValType->isIntegerType() && !ValType->isPointerType() &&
+ !(ValType->isFloatingType() &&
----------------
jhuber6 wrote:
Looking at it closer, there's already some handling for allowing floating point and pointer values in some cases. I do not know why the `_n` variants and some of these were excluded, the comment lists that it must be a fundamental 1-16 byte type but that's true for all fp / ptr types. I'll try to reuse this and remove this check, because I think this can be much more general.
My guess for why we didn't support this was possibly compatibility with GNU? But we have a lot of extra atomic support anyway.
https://github.com/llvm/llvm-project/pull/183843
More information about the cfe-commits
mailing list