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;
}

Reply via email to