dnsampaio added a comment.

@ostannard might prove me wrong, but according to the AACPS:

  When a volatile bit-field is written, and its container does not overlap with 
any non-bit-field member, its
  container must be read exactly once and written exactly once using the access 
width appropriate to the
  type of the container. The two accesses are not atomic.

This rule does not define that the load is done if required. It states that it 
will be read once. It even gives the example that an increment will always 
perform two reads and one write, bitwidth agnostic. It writes just after:

  Note: Note the volatile access rules apply even when the width and alignment 
of the bit-field imply that
  the access could be achieved more efficiently using a narrower type. For a 
write operation the read must
  always occur even if the entire contents of the container will be replaced.

The rationale is to provide a uniform behavior for volatile bitfields 
independent of their width (as far they do not overlap with non-bitfields).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67399/new/

https://reviews.llvm.org/D67399



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to