Skip to content

fix misaligned placement-new storages in runtime - #1691

Open
Shamzik wants to merge 1 commit into
masterfrom
kshamazov/fix-storage-alignment
Open

fix misaligned placement-new storages in runtime#1691
Shamzik wants to merge 1 commit into
masterfrom
kshamazov/fix-storage-alignment

Conversation

@Shamzik

@Shamzik Shamzik commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Static char storages used as backing memory for placement new of array had alignment 1, which is UB when the linker places them at an address not aligned to alignof(array). Add alignas() to all such storages.

Static char storages used as backing memory for placement new of
array<T> had alignment 1, which is UB when the linker places them at
an address not aligned to alignof(array<T>). UBSan (clang-18) reports
"constructor call on misaligned address" at startup of every runtime
unit test. Add alignas() to all such storages.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@Shamzik Shamzik added this to the next milestone Sep 4, 2026
@Shamzik Shamzik self-assigned this Sep 4, 2026
@Shamzik Shamzik added small fix When it's not an huge enhancement runtime Feature related to runtime kphp Affects compiler or runtime in default mode (not K2) labels Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kphp Affects compiler or runtime in default mode (not K2) runtime Feature related to runtime small fix When it's not an huge enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant