AaronBallman wrote:

> Hi @AaronBallman I noticed that this commit makes a difference on the example 
> below.
> 
> ```
> #include <stdatomic.h>
> typedef const struct T * T_Ref;
> static T_Ref _Atomic x = ATOMIC_VAR_INIT((void*)NULL);
> ```
> 
> After this commit, the AST of the global variable declaration changes---a 
> level of `-ImplicitCastExpr '_Atomic(CFStringRef)' <NonAtomicToAtomic>` is 
> removed, resulting in a new `error: initializer element is not a compile-time 
> constant`. (https://godbolt.org/z/aK8E9o47E)

That looks like a bug to me, though `ATOMIC_VAR_INIT` was deprecated in C17 and 
removed in C23 because it isn't a necessary API for initialization. I think 
it's worth filing an issue over.

Did you bisect it to this commit or was this a guess at the cause? I'm not 
certain I see how we could drop the atomic conversion from these changes (but 
the code is dense enough that it may be easy to miss).

https://github.com/llvm/llvm-project/pull/136855
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to