[clang] [Clang][ARM][Sema] Check validity of ldrexd/strexd builtin calls (PR #164919)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 24 10:24:56 PDT 2025


================
@@ -24,3 +24,27 @@ int test_strex(char *addr) {
   res |= __builtin_arm_strex(42, (long long *)addr); // expected-error {{address argument to load or store exclusive builtin must be a pointer to 1,2 or 4 byte type}}
   return res;
 }
+
+int test_ldrexd(char *addr) {
+  int sum = 0;
+  sum += __builtin_arm_ldrexd(addr); // expected-error {{load and store exclusive builtins are not available on this architecture}}
----------------
dgg5503 wrote:

Hi @statham-arm 

Thanks for the review! I've implemented a tweak to the diagnostic as suggested.

However, attempting to make the diagnostic `"%select{|8-byte }0load and store exclusive builtins are not available on this architecture"` results in the following error:
```
error: Diagnostics should not start with a capital letter; '8' is invalid
def err_atomic_exclusive_builtin_pointer_size_none : Error<
    ^
```

So I've opted for the word 'eight', is that acceptable? Maybe it could be 'double-word' if spelling out a number is too awkward.


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


More information about the cfe-commits mailing list