WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@aapoalas
Copy link
Contributor

A bug has slipped into the DoWait method of Atomics: the ValidateAtomicAccess already returns the "byte index in buffer" value (see for instance the Atomics.notify method step 2). In DoWait we instead assume that it returns an index into an Int32Array and later perform the byte multiplication and offsetting manually on top of the value. This is of course entirely wrong and would only work if the original index and offsets are both 0.

@aapoalas aapoalas force-pushed the fix/do-wait-byte-index-in-buffer branch from 4aa5d75 to 4bde5d3 Compare November 17, 2025 05:56
@bakkot bakkot added the editor call to be discussed in the next editor call label Dec 1, 2025
@bakkot bakkot removed the editor call to be discussed in the next editor call label Dec 1, 2025
@syg
Copy link
Contributor

syg commented Dec 1, 2025

Good catch, that's indeed a bug.

@bakkot bakkot added the ready to merge Editors believe this PR needs no further reviews, and is ready to land. label Dec 1, 2025
@ljharb ljharb changed the title fix: DoWait byteIndexInBuffer is miscalculated Normative: DoWait byteIndexInBuffer is miscalculated Dec 1, 2025
@ljharb ljharb added normative change Affects behavior required to correctly evaluate some ECMAScript source text spec bug labels Dec 1, 2025
@ljharb ljharb force-pushed the fix/do-wait-byte-index-in-buffer branch from 4bde5d3 to 4d2116b Compare December 1, 2025 23:17
@ljharb ljharb added the request preview ask the bot to trigger a PR preview label Dec 1, 2025
@github-actions github-actions bot removed the request preview ask the bot to trigger a PR preview label Dec 1, 2025
@github-actions
Copy link

github-actions bot commented Dec 1, 2025

The rendered spec for this PR is available at https://tc39.es/ecma262/pr/3724.

@ljharb ljharb merged commit 4d2116b into tc39:main Dec 1, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

normative change Affects behavior required to correctly evaluate some ECMAScript source text ready to merge Editors believe this PR needs no further reviews, and is ready to land. spec bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants