Spec issues · fixed in the pinned text · docs/spec-issues/22-reads-bytes-from-unbound-result.md
22. reads-bytes-from names an unbound _result_
- Location
- §29.6.2 reads-bytes-from (
#sec-reads-bytes-from), the second condition. - Kind
- an unbound name (a condition that refers to a variable nothing introduces).
- Model erratum
- none:
ReadsBytesFromUnboundResultis retired, and the model reads the pinned text as written. It had one reading,proposed, which is the pinned text: the memory model's meaning (Rbf.Valid,lean/Ecma/MemoryModel.lean) already read "readEvent is not in writes". - Upstream
- Checked 2026-11-19: fixed by PR #4064, "Editorial: Fix an incorrect alias name in reads-bytes-from", merged 2026-11-08 as commit
d8cb87726, which replaced result by readEvent. The unbound name came with PR #3789 (merged 2026-04, commitbab3fbf29), which renamed R to readEvent and Ws to writes but the condition's R to result. PR #4025 (closed without merging, 2026-10) had proposed the same change. - On this site
ReadsBytesFromUnboundResult, retired: removed because the editors fixed the text
The pinned text no longer has this defect: its second condition names readEvent, and the model's erratum
ReadsBytesFromUnboundResult is retired.
Text
The pinned text:
For each ReadSharedMemory or ReadModifyWriteSharedMemory event readEvent in SharedDataBlockEventSet(execution), reads-bytes-from(readEvent) in execution is a List of length readEvent.[[ElementSize]] whose elements are WriteSharedMemory or ReadModifyWriteSharedMemory events writes such that all of the following are true.
Each event writeEvent with index i in writes has readEvent.[[ByteIndex]] + i in its memory range.
readEvent is not in writes.
The second condition before the fix:
result is not in writes.
Problem
The clause binds execution, readEvent, writes, writeEvent and i. No result was in scope, so the second condition had no meaning as written. Its intent is the pinned text's: a ReadModifyWriteSharedMemory event does not read the bytes it writes itself. Without it, an Atomics read-modify-write could read from its own write.
Examples
None run: the condition constrains the candidate executions of the memory model, which no single-agent program and no engine output shows. The formal model defines the memory model in Lean but does not run it.
Proposed wording
None: the pinned text reads "readEvent is not in writes", the wording this write-up proposed.
test262
No test separates the readings: a test would need an execution in which a read-modify-write reads its own write.