julia
0663968c - fix alignment computation for nested objects (#57722)

Commit
1 year ago
fix alignment computation for nested objects (#57722) The alignment of a nested object (in C layouts) is not affected by the alignment of its parent container when computing a field offset (as if it will be allocated at address 0). This can be strongly counter-intuitive (as it implies it should add padding where it does not seem to provide value to the user), but this is required to match the C standard. It also permits users to write custom allocators which happen to provide alignment in excess of that which codegen may assume is guaranteed, and get the behavioral characteristics they intended to specify (without resorting to computing explicit padding). Addresses https://github.com/JuliaLang/julia/issues/57713#issuecomment-2714111074 (Cherry-picked from ec3c02af5cd6e63631c7998792e41c679e1c5364 in v1.11 backports branch)
Author
Committer
Parents
Loading