Submitter: Batty
Submission Date: 2011-10-14
Source: WG 14
Reference Document: N1584
Version: 1.4
Date: April 2014
Subject:
Summary
C11 seems to omit the restriction imposed in C++11 in 29.3p7 (from N3291):For atomic operations A and B on an atomic object M, if there are memory_order_seq_cst fences X and Y such that Ais sequenced before X, Y is sequenced before B, and X precedes Y in S, then B occurs later than A in the modification order of M.Furthermore, it seems that both C11 and C++11 are missing the following two derivatives of this rule:
For atomic modifications A and B of an atomic object M, if there is a memory_order_seq_cst fence X such that A is sequenced before X, and X precedes B in S, then B occurs later than A in the modification order of M.
For atomic modifications A and B of an atomic object M, if there is a memory_order_seq_cst fence Y such that Y is sequenced before B, and A precedes Y in S, then B occurs later than A in the modification order of M.
Suggested Technical Corrigendum
See above.Committee Discussion
Feb 2012 meeting
- The changes are difficult to fully understand - a diagram might help.
- A paper for the next meeting would help the Committee make progress on this.
- Some concern about having C and C++ differ.
Committee Discussion
Oct 2012 meeting
- No work was done on this defect between meetings, so no additional information has been provided.
- There seems to be two issues here, and this should possibility be two defect reports rather than one.
- No known liaison has taken place with WG 21 on this issue.
- The proposed words are inappropriate for C, still need words that work for C.
- There seems to be editorial issues with the proposed words for C++ as well.
- There is consensus to adopt something along the lines of the first proposed change, with wording that is consistent with C.
- WG 14 needs to stay in step with WG 21.
- Clark Nelson took an action item to liaise with WG 21.
Committee Discussion
Oct 2013 meeting
- This item has also become WG21 Library Issue 2130.
- Rajan presented a diagram and argued that we should adopt the first part and that the second two parts were redundant.
After 7.17.3 paragraph 11 add the following:
For atomic operations A and B on an atomic object M, if there are memory_order_seq_cst fences X and Y such that A is sequenced before X, Y is sequenced before B, and X precedes Y in S, then B occurs later than A in the modification order of M.
Committee Discussion
Change 29.3 [atomics.order] paragraph 7 as indicated: [Drafting note: Note that the wording change intentionally does also replace the term atomic operation by atomic modification]
-7-
For atomic operations A and B on an atomic object M, if there are memory_order_seq_cst fences X and Y such that A is sequenced before X, Y is sequenced before B, and X precedes Y in S, then B occurs later than A in the modification order of M.For atomic modifications A and B of an atomic object M, B occurs later than A in the modification order of M if:
- there is a memory_order_seq_cst fence X such that A is sequenced before X, and X precedes B in S, or
- there is a memory_order_seq_cst fence Y such that Y is sequenced before B, and A precedes Y in S, or
- there are memory_order_seq_cst fences X and Y such that A is sequenced before X, Y is sequenced before B, and X precedes Y in S.
Committee Discussion
WG21 liaison has been asked to ascertain status of this w.r.t. C++14 and to provide a suggested TC.