[Bug c/69002] C front end should warn about undefined access to atomic structure or union
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 21 17:55:00 GMT 2015
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;
}
More information about the Gcc-bugs
mailing list