Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atomic_load/atomic_compare_exchange_weak does not work on structures #1092

Open
farkasmark opened this issue Jan 18, 2024 · 0 comments
Open
Assignees
Labels
accepted We intend to address this issue.

Comments

@farkasmark
Copy link

The following code gives a compilation error using cosmocc (GCC) 11.2.0, while the code compiles without any error using GCC/Clang.

hello.c: In function ‘main’:
hello.c:11:3: error: operand type ‘_Atomic atomic_ant *’ {aka ‘_Atomic ant *’} is incompatible with argument 1 of ‘__atomic_load_n’
   11 |   ant ant2 = atomic_load(&ant1);
      |   ^~~
#include <stdatomic.h>

typedef struct ant {
    int b;
} ant;

typedef _Atomic(ant) atomic_ant;

int main(int argc, char *argv[]) {
  atomic_ant ant1 = { .b = 5 };
  ant ant2 = atomic_load(&ant1);
  return 0;
}
@jart jart self-assigned this Jan 18, 2024
@jart jart added the accepted We intend to address this issue. label Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted We intend to address this issue.
Projects
None yet
Development

No branches or pull requests

2 participants