[clang] [Clang] Throw error when calling atomic with pointer to zero size object (PR #91057)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 11:32:15 PDT 2024


================
@@ -330,6 +330,9 @@ def warn_atomic_op_misaligned : Warning<
   "; the expected alignment (%0 bytes) exceeds the actual alignment (%1 bytes)">,
   InGroup<AtomicAlignment>;
 
+def err_atomic_op_size_zero : Error<
----------------
AaronBallman wrote:

Rather than introduce a new diagnostic, I think it makes more sense to modify `err_atomic_builtin_must_be_pointer` to say "... must be a pointer %select{to a non-zero-sized object}1 (%0 invalid)".

https://github.com/llvm/llvm-project/pull/91057


More information about the cfe-commits mailing list