Fix incorrect 64-bit alignment computation for records with a vtable#703
Merged
tannergooding merged 1 commit intoJul 12, 2026
Merged
Conversation
GetTypeSize computed the 64-bit alignment for a record with a vtable by clamping alignment32 instead of alignment64, so the result was wrong whenever the two values diverged. The 32-bit sibling branch already uses alignment32; make the 64-bit branch use alignment64 as intended. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
tannergooding
force-pushed
the
tannergooding-repo-analysis
branch
from
July 12, 2026 20:13
270bb46 to
6a33fb1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GetTypeSize(inPInvokeGenerator.TypeResolution.cs) computed the 64-bit alignment for a record with a vtable by clampingalignment32instead ofalignment64:The 32-bit sibling branch just above already uses
alignment32; this makes the 64-bit branch usealignment64as intended.This is latent in the covered configurations —
alignment32andalignment64are equal on entry to this branch in the tested cases, so no golden output changes and the full suite passes unchanged. It's still an obvious correctness bug that bites once the two alignments diverge, hence the surgical fix. I couldn't construct a triggering golden-file case, so no test is added; happy to add one if you know a scenario that diverges them here.Builds clean under
TreatWarningsAsErrors.First in a small series coming out of an analysis pass. The redundant
IsVirtual && IsVirtualinHasVtblI also spotted was already fixed upstream, so it's dropped from this PR.