Skip to content

Initialize nvexec variant index before construction - #2192

Open
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix/nvexec-variant-index-initialization
Open

Initialize nvexec variant index before construction#2192
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix/nvexec-variant-index-initialization

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • initialize the variant discriminator to npos before the default constructor calls emplace
  • add a regression that constructs a variant in zero-filled storage and checks that the first alternative is not destroyed before construction

Why

variant_t default construction calls emplace, which calls destroy before constructing the first alternative. Since index_ was not initialized yet, holds_alternative read an indeterminate value and could treat raw storage as an active alternative.

@copy-pr-bot

copy-pr-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@fallintoplace
fallintoplace force-pushed the fix/nvexec-variant-index-initialization branch from 8edcaa4 to 4e6ac42 Compare August 11, 2026 23:41
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.

1 participant