Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I guess the "Lack of memory model" in these cases just means that the optimizers were written before the C++11 memory model got published, and might perform now invalid optimizations. It's very difficult and time-consuming to validate optimizations against the memory model, so it's no big surprise that the clang/gcc teams haven't finished that yet.</p> <blockquote> <p>Does a lack of memory model support means that legal C++11 programs that use std::atomic arent seq consistent?</p> </blockquote> <p>Yes, that's a possibility. It's even worse: the compiler might introduce data races into (according to the C++11 standard) race-free programs, e.g. by introducing speculative writes.</p> <p>For example, several C++ compilers used to perform this optimization:</p> <pre><code>for (p = q; p = p -&gt; next; ++p) { if (p -&gt; data &gt; 0) ++count; } </code></pre> <p>Could get optimized into:</p> <pre><code>register int r1 = count; for (p = q; p = p -&gt; next; ++p) { if (p -&gt; data &gt; 0) ++r1; } count = r1; </code></pre> <p>If all <code>p-&gt;data</code> are non-negative, the original source code did not write to <code>count</code>, but the optimized code does. This can introduce a data race in an otherwise race-free program, so the C++11 specification disallows such optimizations. Existing compilers now have to verify (and adjust if necessary) all optimizations.</p> <p>See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2338.html" rel="noreferrer">Concurrency memory model compiler consequences</a> for details.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload