[clang] [lldb] [llvm] [clang] crash fix bodyfarm osatomic cmpswap #197211 (PR #197489)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Fri May 15 04:27:21 PDT 2026


================
@@ -18,3 +18,23 @@ int rdar9339920_test() {
   return 0;
 }
 
+// Regression test for issue #197211
+// When the user-declared OSAtomicCompareAndSwap* prototype has mismatched
+// oldValue/ newValue/ *theValue types, BodyFarm previously asserted while
+// synthesizing the body. It should bail out gracefully and let the analyzer
+// fall back to generic call semantics.
+bool OSAtomicCompareAndSwap(char32_t __oldValue, int __newValue,
+                            volatile int *_theValue);
+int gh197211_flag;
+void gh197211_test() {
+  if (OSAtomicCompareAndSwap(0, 0, &gh197211_flag))
+    ;
----------------
NagyDonat wrote:

```suggestion
  OSAtomicCompareAndSwap(0, 0, &gh197211_flag);
```

Why do you include the `if` in this testcase? I see that in real-world code this function call would usually appear as the condition of an `if`, but it doesn't seem to be relevant for the reproduction of this bug.

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


More information about the cfe-commits mailing list