https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105495

--- Comment #1 from LIU Hao <lh_mouse at 126 dot com> ---
A possible workaround is to use a scalar type to provide storage for local
variables, and cast them as needed:

Godbolt: https://gcc.godbolt.org/z/n7zq7Pn4G

```c
typedef struct { int b; } cond;

int
__MCF_batch_release_common(cond* p, int c);

int
_MCF_cond_signal_some(cond* p, int x)
  {
    int c = {x}, n = {2};
    __atomic_compare_exchange((cond*)p, (cond*)&c, (cond*)&n, 1, 0, 0);
    return __MCF_batch_release_common(p, x);
  }
```

This makes GCC output the same assembly as Clang.

Reply via email to