-
Notifications
You must be signed in to change notification settings - Fork 72
Meaning of "natural alignment" is unclear #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It seems on wasm those two definitions coincide for each type? Maybe that's clear to everyone involved; as someone working on a general-purpose compiler and stumbling upon this document after being dragged into a wasm discussion, that has not been clear to me. ;) |
Thanks for pointing this out. I'm pretty sure I've always used the latter meaning (and the spec does as well). But in this case it may be that we actually mean the first. Oops, I see that I'm racing you ... |
The table on the page I referenced above says that |
Yes, I think all the types actually have what I would term "natural alignment" except emscripten's long double, but that may be passed in a pair of i64 values for ABI purposes. |
But if there's going to be some kind of obscure bug, I would bet on a case like long double, since it's a weird and obscure type anyway. |
Well this is the question. Consider this type (Rust syntax, as I do not know the equivalent C syntax ;) #[repr(align(16))]
struct T(f128); If we take the first meaning of the two I described for "natural alignment", then it should be passed directly on emscripten, meaning in two |
typedef struct
{
alignas(16) _Float128 value;
} AlignedF128; |
Uh oh!
There was an error while loading. Please reload this page.
The CABI documentation uses the term "natural alignment" of a type without defining its meaning. Talking to different people I have encountered two common meanings of this word:
For the sake of clarity of this spec, it would be good to spell out exactly which meaning is intended here.
The text was updated successfully, but these errors were encountered: