clang doesn't drop the top level _Atomic qualifier when inferring an __auto_type from an initializer #63659
Open
Description
When the following code is compiled, the type of b is _Atomic int instead of int:
$ cat test.c
_Atomic int a;
int g;
void test() {
__auto_type b = a;
g = b;
}
$ clang -S -o - -emit-llvm test.c
define void @test() #0 {
entry:
%b = alloca i32, align 4
%atomic-load = load atomic i32, ptr @a seq_cst, align 4
store i32 %atomic-load, ptr %b, align 4
%atomic-load1 = load atomic i32, ptr %b seq_cst, align 4
store i32 %atomic-load1, ptr @g, align 4
ret void
}
This seems to differ from gcc's behavior if I understand its output in https://godbolt.org correctly. gcc drops _Atomic just like it drops const when it infers the type of d in the following code:
$ cat test.c
const int c = 100;
void test() {
__auto_type d = c;
d = 123;
}
Activity