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
Athat modifies an atomic objectMhappens before an operationBthat modifiesM, thenAshall be earlier thanBin the modification order ofM.NOTE: The requirement above is known as write-write coherence.
If a value computation
Aof an atomic objectMhappens before a value computationBofM, andAtakes its value from a side effectXonM, then the value computed byBshall either be the value stored byXor the value stored by a side effectYonM, whereYfollowsXin the modification order ofM.NOTE: The requirement above is known as read-read coherence.
If a value computation
Aof an atomic objectMhappens before an operationBonM, thenAshall take its value from a side effectXonM, whereXprecedesBin the modification order ofM.NOTE: The requirement above is known as read-write coherence.
If a side effect
Xon an atomic objectMhappens before a value computationBofM, then the evaluationBshall take its value fromXor from a side effectYthat followsXin 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
Athat modifies an atomic objectMhappens before an operationBthat modifiesM, thenAshall be earlier thanBin the modification order ofM.NOTE: The requirement above is known as write-write coherence.
If a value computation
Aof an atomic objectMhappens before a value computationBofM, andAtakes its value from a side effectXonM, then the value computed byBshall either be the value stored byXor the value stored by a side effectYonM, whereYfollowsXin the modification order ofM.NOTE: The requirement above is known as read-read coherence.
If a value computation
Aof an atomic objectMhappens before an operationBonM, thenAshall take its value from a side effectXonM, whereXprecedesBin the modification order ofM.NOTE: The requirement above is known as read-write coherence.
If a side effect
Xon an atomic objectMhappens before a value computationBofM, then the evaluationBshall take its value fromXor from a side effectYthat followsXin the modification order ofM.NOTE: The requirement above is known as write-read coherence.