## Defect Report #402

Previous Defect Report < - > Next Defect Report

Submitter: Batty
Submission Date: 2011-10-14
Source: WG 14
Reference Document: N1584
Version: 1.2
Date: February 2012
Subject: memory model coherence is not aligned with C++11

Summary

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 object M happens before an operation B that modifies M , then A shall be earlier than B in the modification order of M .

NOTE: The requirement above is known as write-write coherence.

If a value computation A of an atomic object M happens before a value computation B of M , and A takes its value from a side effect X on M, then the value computed by B shall either be the value stored by X or the value stored by a side effect Y on M, where Y follows X in the modification order of M.

NOTE: The requirement above is known as read-read coherence.

If a value computation A of an atomic object M happens before an operation B on M, then A shall take its value from a side effect X on M, where X precedes B in the modification order of M.

NOTE: The requirement above is known as read-write coherence.

If a side effect X on an atomic object M happens before a value computation B of M, then the evaluation B shall take its value from X or from a side effect Y that follows X in the modification order of M.

NOTE: The requirement above is known as write-read coherence.

Suggested Technical Corrigendum

See above.
Oct 2011 meeting

Committee Discussion

• The consensus was that this is an oversight, and should be changed as recommended.
Feb 2012 meeting

Proposed Technical Corrigendum

In 5.1.2.4 Paragraph 22 starting at the third sentence, add:
If an operation A that modifies an atomic object M happens before an operation B that modifies M , then A shall be earlier than B in the modification order of M .

NOTE: The requirement above is known as write-write coherence.

If a value computation A of an atomic object M happens before a value computation B of M , and A takes its value from a side effect X on M, then the value computed by B shall either be the value stored by X or the value stored by a side effect Y on M, where Y follows X in the modification order of M.

NOTE: The requirement above is known as read-read coherence.

If a value computation A of an atomic object M happens before an operation B on M, then A shall take its value from a side effect X on M, where X precedes B in the modification order of M.

NOTE: The requirement above is known as read-write coherence.

If a side effect X on an atomic object M happens before a value computation B of M, then the evaluation B shall take its value from X or from a side effect Y that follows X in the modification order of M.

NOTE: The requirement above is known as write-read coherence.
{"ft_lang_label":"__label__en","ft_lang_prob":0.9191722,"math_prob":0.88816833,"size":3062,"snap":"2022-40-2023-06","text_gpt3_token_len":702,"char_repetition_ratio":0.13570961,"word_repetition_ratio":0.75949365,"special_character_ratio":0.23122142,"punctuation_ratio":0.10248447,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.95331943,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-09-29T20:52:59Z\",\"WARC-Record-ID\":\"<urn:uuid:32eb1589-b6c1-41de-a993-5945208c0629>\",\"Content-Length\":\"5648\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:70430b56-d5ac-4bf5-afe2-1974dd8c2f8c>\",\"WARC-Concurrent-To\":\"<urn:uuid:c172e662-8d62-477e-979f-64d9cf6a5f50>\",\"WARC-IP-Address\":\"192.38.78.170\",\"WARC-Target-URI\":\"https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_402.htm\",\"WARC-Payload-Digest\":\"sha1:BLOQBCRTDGZEPETYIALWXP7RTIRJBPJU\",\"WARC-Block-Digest\":\"sha1:24MYM5Z3LPSSIOFO4XMBWZ7ACYJBU2EZ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030335365.63_warc_CC-MAIN-20220929194230-20220929224230-00114.warc.gz\"}"}