This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/71949] ATOMIC_FLAG_INIT definition in stdatomic.h
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 26 Jul 2016 21:51:35 +0000
- Subject: [Bug c/71949] ATOMIC_FLAG_INIT definition in stdatomic.h
- Auto-submitted: auto-generated
- References: <bug-71949-4@http.gcc.gnu.org/bugzilla/>
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.