Hello Bart,

Thanks for the summary.  There are good pointers in this e-mail thread
regarding the current state of the process of defining memory model
for C++ (and eventually for C I guess).

>From those pointers several conclusions may be made (which are in line
with that you said):

  - though neither Standard C nor POSIX require to use volatile, it
    seems like you have to use it until the memory model is clearly
    defined.

  - the compiler should not introduce speculative stores to the shared
    objects.  This is what my original question was about.  I haven't
    read all the papers yet, so one thing is still unclear to me: it
    seems like atomic variables will be annotated as such
    (atomic<int>).  But I found no proposal for annotation of
    non-atomic objects that are protected by the ordinary locks (like
    mutexes).  Will the compiler be forbiden to do all speculative
    stores, or how will it recognize shared objects as such?

  - the compiler should not cross object boundary when doing the store
    (i.e. when storing to 8-bit char it should not store to the whole
    32/64-bit word).  Here's the same question about shared object
    annotation.


Cheers,

-- 
   Tomash Brechko

Reply via email to