Skip to content

free_list: read the node count atomically in unittests - #11170

Merged
thewilsonator merged 1 commit into
dlang:masterfrom
atilaneves:free-list-unittest-atomicload
Dec 2, 2026
Merged

thewilsonator merged 1 commit into
dlang:masterfrom
atilaneves:free-list-unittest-atomicload

Conversation

@atilaneves

@atilaneves atilaneves commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Split out of #11169. The SharedFreeList unittests read the shared node count directly, which -preview=nosharedaccess doesn't allow:

+    import core.atomic : atomicLoad;
-    assert(a.nodes == 1);
+    assert(atomicLoad(a.nodes) == 1);

Same for the other eight asserts. Unittests only.

Evidence

With dmd master, -preview=nosharedaccess -unittest -version=StdUnittest, and the SharedFreeList changes from #11169 applied:

  • Before: 9 errors, e.g. free_list.d(1232): Error: direct access to shared 'a.nodes' is not allowed, see 'core.atomic'
    After: compiles, and the module's 20 unittests pass.

Without the flag, the 20 unittests pass with this PR alone. With the flag the module still needs #11169 to compile.

🤖 Generated with Claude Code

The SharedFreeList unittests read the shared node count directly, which
-preview=nosharedaccess doesn't allow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thewilsonator
thewilsonator merged commit c1be167 into dlang:master Dec 2, 2026
7 of 9 checks passed
@0xEAB 0xEAB added Severity:Enhancement Review:AI Generated Code as well as issues that are generated by an LLM AI — or suspected to be. labels Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review:AI Generated Code as well as issues that are generated by an LLM AI — or suspected to be. Severity:Enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants