[all-commits] [llvm/llvm-project] bd7bb2: [clang] Match MSVC ABI for over-aligned base tail ...
Daniel Paoliello via All-commits
all-commits at lists.llvm.org
Mon Jul 27 12:15:58 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bd7bb26108bd86eeeef0962577b52d0f435a7ac3
https://github.com/llvm/llvm-project/commit/bd7bb26108bd86eeeef0962577b52d0f435a7ac3
Author: Daniel Paoliello <danpao at microsoft.com>
Date: 2026-07-27 (Mon, 27 Jul 2026)
Changed paths:
M clang/docs/ReleaseNotes.md
M clang/include/clang/AST/RecordLayout.h
M clang/lib/AST/RecordLayout.cpp
M clang/lib/AST/RecordLayoutBuilder.cpp
A clang/test/Layout/ms-arm64-aligned-base-tail-padding.cpp
Log Message:
-----------
[clang] Match MSVC ABI for over-aligned base tail padding on Arm64 (#210461)
When targeting aarch64-pc-windows-msvc, clang laid out a base following
an over-aligned, non-standard-layout base at the wrong offset. MSVC on
Arm64 reuses the over-aligned base's tail padding for the subsequent
base, but clang rounded the base up to a full slot, so the two disagreed
on member offsets, breaking interop between clang- and MSVC-built
binaries.
Fix: store each record's natural non-virtual alignment (excluding
`alignas`/`__declspec(align)` over-alignment) as
`getNonRequiredNVAlignment()`, and on Arm64 fold in a base's natural
alignment rather than its full alignment. This is gated to Arm64 only;
Arm64EC and x64 follow the x64 rule (no reuse) and are unchanged.
Validated against MSVC (Hostx64\arm64\cl.exe
/d1reportSingleClassLayout): clang now matches MSVC Arm64 exactly for
the reduced repro, the original polymorphic case (vftable + empty base +
template), and a range of probe cases covering natural vs.
over-alignment padding and field vs. base reuse. Arm64EC and x64 output
is byte-identical to before.
Fixes #210174
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list