This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/71949] ATOMIC_FLAG_INIT definition in stdatomic.h


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

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
ATOMIC_FLAG_INIT is an initializer, not an expression that can be used in 
assignments.

The C11 model is that it may not be valid to do assignments such as

>   atomic_flag f2;
>   f2 =  ATOMIC_FLAG_INIT;

because an atomic object may need extra state that is specially 
initialized before assignments can be carried out on it (hence 
initialization using separate macros from assignment).

See the response to DR#454, explicitly saying ATOMIC_VAR_INIT is only for 
initialization.  Much the same would apply to ATOMIC_FLAG_INIT.

Now, GCC does not support the cases that require extra state to be 
initialized, but this does not make uses of *_INIT in non-initializers 
valid.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]