This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/69002] C front end should warn about undefined access to atomic structure or union
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 21 Dec 2015 16:34:02 +0000
- Subject: [Bug c/69002] C front end should warn about undefined access to atomic structure or union
- Auto-submitted: auto-generated
- References: <bug-69002-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69002
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |msebor at gcc dot gnu.org
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
I actually wouldn't want to see GCC start issuing warnings for this code
because it has well-defined semantics there. It is true that the standard says
accessing an atomic object that hasn't been initialized using one of the
ATOMIC_VAR_INIT() or atomic_init() macros is undefined but that's a historical
accident caused by an incomplete integration of atomic types into the C11 core
language. It's on my to do list to submit an issue for the next WG14 meeting
to have the requirement removed.
The details of why this code is safe in all known implementations are explained
in my upcoming blog entry. If you see problems with it or have concerns please
let me know before it's published! :)