Skip to content

Fix seq[var T] payload layout; fixes #26058 - #26078

Closed
subotac wants to merge 1 commit into
nim-lang:develfrom
subotac:fix/seq-var-payload-layout
Closed

Fix seq[var T] payload layout; fixes #26058#26078
subotac wants to merge 1 commit into
nim-lang:develfrom
subotac:fix/seq-var-payload-layout

Conversation

@subotac

@subotac subotac commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #26058.

Treat the var element modifier as an access property when generating sequence payload types, keeping seq[var T] ABI-compatible with seq[T].

Add a regression test covering variant-object stride and in-place mutation.

@Araq

Araq commented Aug 4, 2026

Copy link
Copy Markdown
Member

keeping seq[var T] ABI-compatible with seq[T].

What? No, that's not good enough.

@subotac

subotac commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

You're right — var T is still a reference element here, so stripping it only from the payload makes codegen inconsistent (Item** vs Item*). I'll drop this approach rather than patch it further in the backend.

@subotac subotac closed this Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

seq[var T].mitems() uses incorrect element stride for variant case-object T with 2+ elements, causing writes to the wrong element's memory

2 participants