From Jason Turner

[intro.races]

Diff to HTML by rtfpessoa

tmp/tmpb78y62qx/{from.md → to.md} RENAMED
@@ -3,12 +3,12 @@
3
  The value of an object visible to a thread T at a particular point is
4
  the initial value of the object, a value assigned to the object by T, or
5
  a value assigned to the object by another thread, according to the rules
6
  below.
7
 
8
- [*Note 1*: In some cases, there may instead be undefined behavior. Much
9
- of this subclause is motivated by the desire to support atomic
10
  operations with explicit and detailed visibility constraints. However,
11
  it also implicitly supports a simpler view for more restricted
12
  programs. — *end note*]
13
 
14
  Two expression evaluations *conflict* if one of them modifies a memory
@@ -41,11 +41,11 @@ All modifications to a particular atomic object M occur in some
41
  particular total order, called the *modification order* of M.
42
 
43
  [*Note 3*: There is a separate order for each atomic object. There is
44
  no requirement that these can be combined into a single total order for
45
  all objects. In general this will be impossible since different threads
46
- may observe modifications to different objects in inconsistent
47
  orders. — *end note*]
48
 
49
  A *release sequence* headed by a release operation A on an atomic object
50
  M is a maximal contiguous sub-sequence of side effects in the
51
  modification order of M, where the first operation is A, and every
@@ -254,12 +254,12 @@ computation of an object being taken from the last side effect on that
254
  object in that interleaving. This is normally referred to as “sequential
255
  consistency”. However, this applies only to data-race-free programs, and
256
  data-race-free programs cannot observe most program transformations that
257
  do not change single-threaded program semantics. In fact, most
258
  single-threaded program transformations continue to be allowed, since
259
- any program that behaves differently as a result must perform an
260
- undefined operation. — *end note*]
261
 
262
  Two accesses to the same object of type `volatile std::sig_atomic_t` do
263
  not result in a data race if both occur in the same thread, even if one
264
  or more occurs in a signal handler. For each signal handler invocation,
265
  evaluations performed by the thread invoking a signal handler can be
@@ -275,17 +275,17 @@ potentially shared memory location that would not be modified by the
275
  abstract machine are generally precluded by this document, since such an
276
  assignment might overwrite another assignment by a different thread in
277
  cases in which an abstract machine execution would not have encountered
278
  a data race. This includes implementations of data member assignment
279
  that overwrite adjacent members in separate memory locations. Reordering
280
- of atomic loads in cases in which the atomics in question may alias is
281
- also generally precluded, since this may violate the coherence
282
  rules. — *end note*]
283
 
284
  [*Note 23*: Transformations that introduce a speculative read of a
285
- potentially shared memory location may not preserve the semantics of the
286
- C++ program as defined in this document, since they potentially
287
  introduce a data race. However, they are typically valid in the context
288
  of an optimizing compiler that targets a specific machine with
289
  well-defined semantics for data races. They would be invalid for a
290
  hypothetical machine that is not tolerant of races or provides hardware
291
  race detection. — *end note*]
 
3
  The value of an object visible to a thread T at a particular point is
4
  the initial value of the object, a value assigned to the object by T, or
5
  a value assigned to the object by another thread, according to the rules
6
  below.
7
 
8
+ [*Note 1*: In some cases, there might instead be undefined behavior.
9
+ Much of this subclause is motivated by the desire to support atomic
10
  operations with explicit and detailed visibility constraints. However,
11
  it also implicitly supports a simpler view for more restricted
12
  programs. — *end note*]
13
 
14
  Two expression evaluations *conflict* if one of them modifies a memory
 
41
  particular total order, called the *modification order* of M.
42
 
43
  [*Note 3*: There is a separate order for each atomic object. There is
44
  no requirement that these can be combined into a single total order for
45
  all objects. In general this will be impossible since different threads
46
+ can observe modifications to different objects in inconsistent
47
  orders. — *end note*]
48
 
49
  A *release sequence* headed by a release operation A on an atomic object
50
  M is a maximal contiguous sub-sequence of side effects in the
51
  modification order of M, where the first operation is A, and every
 
254
  object in that interleaving. This is normally referred to as “sequential
255
  consistency”. However, this applies only to data-race-free programs, and
256
  data-race-free programs cannot observe most program transformations that
257
  do not change single-threaded program semantics. In fact, most
258
  single-threaded program transformations continue to be allowed, since
259
+ any program that behaves differently as a result has undefined
260
+ behavior. — *end note*]
261
 
262
  Two accesses to the same object of type `volatile std::sig_atomic_t` do
263
  not result in a data race if both occur in the same thread, even if one
264
  or more occurs in a signal handler. For each signal handler invocation,
265
  evaluations performed by the thread invoking a signal handler can be
 
275
  abstract machine are generally precluded by this document, since such an
276
  assignment might overwrite another assignment by a different thread in
277
  cases in which an abstract machine execution would not have encountered
278
  a data race. This includes implementations of data member assignment
279
  that overwrite adjacent members in separate memory locations. Reordering
280
+ of atomic loads in cases in which the atomics in question might alias is
281
+ also generally precluded, since this could violate the coherence
282
  rules. — *end note*]
283
 
284
  [*Note 23*: Transformations that introduce a speculative read of a
285
+ potentially shared memory location might not preserve the semantics of
286
+ the C++ program as defined in this document, since they potentially
287
  introduce a data race. However, they are typically valid in the context
288
  of an optimizing compiler that targets a specific machine with
289
  well-defined semantics for data races. They would be invalid for a
290
  hypothetical machine that is not tolerant of races or provides hardware
291
  race detection. — *end note*]