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

DonĂ¡t Nagy via lldb-commits lldb-commits at lists.llvm.org
Fri May 15 04:27:22 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))
+    ;
+}
+
+bool OSAtomicCompareAndSwapMismatchedPointee(int __oldValue, int __newValue,
+                                             volatile long *_theValue);
+long gh197211_long_flag;
+void gh197211_test2() {
+  if (OSAtomicCompareAndSwapMismatchedPointee(0, 0, &gh197211_long_flag))
+    ;
----------------
NagyDonat wrote:

```suggestion
  OSAtomicCompareAndSwapMismatchedPointee(0, 0, &gh197211_long_flag);
```
Same as above, the `if` seems to be superfluous.

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


More information about the lldb-commits mailing list