This issue has been automatically converted from the original issue lists and some formatting may not have been preserved.
Authors: WG 14, Batty
Date: 2011-10-14
Reference document: N1584
Submitted against: C11 / C17
Status: Fixed
Fixed in: C17
Cross-references: 0406
Converted from: n2396.htm
The memory model described in N1569 matches an older version of the C++0x memory model, one that allowed executions that were not intended by the designers. The recommandation is to match the C++11 text by removing the sentence starting 'Furthermore' in 5.1.2.4p22, and including the following paragraphs in section 5.1.2.4 (Taken from C++ N3291, 1.10p15 through 18):
If an operation
A
that modifies an atomic objectM
happens before an operationB
that modifiesM
, thenA
shall be earlier thanB
in the modification order ofM
.NOTE: The requirement above is known as write-write coherence.
If a value computation
A
of an atomic objectM
happens before a value computationB
ofM
, andA
takes its value from a side effectX
onM
, then the value computed byB
shall either be the value stored byX
or the value stored by a side effectY
onM
, whereY
followsX
in the modification order ofM
.NOTE: The requirement above is known as read-read coherence.
If a value computation
A
of an atomic objectM
happens before an operationB
onM
, thenA
shall take its value from a side effectX
onM
, whereX
precedesB
in the modification order ofM
.NOTE: The requirement above is known as read-write coherence.
If a side effect
X
on an atomic objectM
happens before a value computationB
ofM
, then the evaluationB
shall take its value fromX
or from a side effectY
that followsX
in the modification order ofM
.NOTE: The requirement above is known as write-read coherence.
See above.
Comment from WG14 on 2017-11-03:
Oct 2011 meeting
- The consensus was that this is an oversight, and should be changed as recommended.
Feb 2012 meeting
In 5.1.2.4 Paragraph 22 starting at the third sentence, add:
If an operation
A
that modifies an atomic objectM
happens before an operationB
that modifiesM
, thenA
shall be earlier thanB
in the modification order ofM
.NOTE: The requirement above is known as write-write coherence.
If a value computation
A
of an atomic objectM
happens before a value computationB
ofM
, andA
takes its value from a side effectX
onM
, then the value computed byB
shall either be the value stored byX
or the value stored by a side effectY
onM
, whereY
followsX
in the modification order ofM
.NOTE: The requirement above is known as read-read coherence.
If a value computation
A
of an atomic objectM
happens before an operationB
onM
, thenA
shall take its value from a side effectX
onM
, whereX
precedesB
in the modification order ofM
.NOTE: The requirement above is known as read-write coherence.
If a side effect
X
on an atomic objectM
happens before a value computationB
ofM
, then the evaluationB
shall take its value fromX
or from a side effectY
that followsX
in the modification order ofM
.NOTE: The requirement above is known as write-read coherence.