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: "mpolacek 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 17:55:42 +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
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The footnote to 6.5.2.3/5 says "Members can be safely accessed using a
non-atomic object which is assigned to or from the atomic object." Does it
mean that the following is OK?
typedef struct
{
int x;
} S;
int
read1 (_Atomic S p)
{
S s = p;
return s.x;
}
int
read2 (_Atomic S *p)
{
S *s = p;
return s->x;
}
void
write1 (_Atomic S p, int x)
{
S s = p;
s.x = x;
}
void
write2 (_Atomic S *p, int x)
{
S *s = p;
s->x = x;
}