P3181R1 — Atomic stores and object lifetimes
(6 items)
SG1
The C++ object lifetime rules require that the last update to an object happens-before its destruction, but this is overly conservative when the final access is a relaxed atomic store preceded by a release fence. This paper proposes relaxing the rule so that an atomic store is considered 'before' the end of an object's lifetime if a load observing that store happens-before the end of the lifetime, thereby allowing fence-plus-relaxed-store patterns to safely synchronize object destruction just as release stores can.
-
Introduction, page 2 — The prose describes the scenario as involving 'a store to an atomic
' but the corresponding detailed code example uses atomic . One or the other should be changed for consistency. [1] - Introduction, page 2 — 'the difference between fence; relaxed-store is usually stronger than release-store' is grammatically broken: 'the difference between X' requires a second comparand ('and Y'), or 'the difference between' should be dropped entirely. [2]
- Introduction, page 2 — 'the store to A' switches preposition and referent from the preceding 'the store in A' (where A is Thread A). Storing 'to' a thread is nonsensical; should read 'the store in A' for consistency. [3]
- Page 3 — Run-on conditional: the 'if' clause ending at 'b1' lacks a comma and subject pronoun before 'would'. Should read '...that a1 did happen-before b1, that would effectively turn...'. [4]
- Proposed wording, page 5, modification to [basic.life] p1 Note — The parenthetical 'possibly preceded by an atomic_thread_fence()' is opened with a comma but not closed with one before 'to inform,' causing a misparsing where the fence rather than the store is what informs the other thread. [5]
References — Anthropic Citations API
[1]
"it is a store to an atomic ... c1: b = new atomic(0);"
"it is a store to an atomic
[2]
"For something like the standard message passing litmus test the difference between "fence; relaxed-store" is usually stronger than "release-store", and the difference often doesn't matter."
"For something like the standard message passing litmus test the difference between "fence; relaxed-store" is usually stronger than "release-store", and the difference often doesn't matter."
[3]
"It is not fine if the store to A is a release fence, followed by a relaxed store"
"It is not fine if the store to A is a release fence, followed by a relaxed store"
[4]
"If we somehow promised that a1 did happen-before b1 would effectively turn memory_order::relaxed into memory_order::release, which is clearly unacceptable."
"If we somehow promised that a1 did happen-before b1 would effectively turn memory_order::relaxed into memory_order::release, which is clearly unacceptable."
[5]
"This allows a memory_order_relaxed store, possibly preceded by an atomic_thread_fence() to inform another thread that an object is ready for deletion."
"This allows a memory_order_relaxed store, possibly preceded by an atomic_thread_fence() to inform another thread that an object is ready for deletion."
Summary: P3181R1 proposes clarifying the C++ standard to explicitly permit compilers to move atomic stores past the end of an object's lifetime, adding a non-normative note to [basic.life] and non-binding recommendations to [atomics.order] that acknowledge this existing implementation practice. Five editorial and grammatical issues were found in the paper's prose and proposed wording.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.