A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/llvm/llvm-project/issues/48742 below:

clang rejects valid code that uses _Atomic · Issue #48742 · llvm/llvm-project · GitHub

Extended Description

Command (where ex.c is the attached file):

clang -std=c17 -c ex.c

LLVM revision from which clang was built: 493f140

Expected behaviour: the program should compile successfully.

Actual behaviour: clang gives this error:

ex.c:3:7: error: initializing 'int' with an expression of incompatible type '_Atomic(int)'

The program is successfully compiled by gcc 9.3.0.

The program in the attached file is:

void foo() {
_Atomic int x;
int y = (x = 2);
}

which I believe is valid: it's fine to initialize a non-atomic int using an atomic int.

If the declaration of y is changed to:

int y = x;

then the program compiles successfully.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4