[llvm-dev] Does an array and homogeneous struct have the same layout?
Tim Northover via llvm-dev
llvm-dev at lists.llvm.org
Sun Apr 8 03:15:32 PDT 2018
On 8 April 2018 at 10:46, edA-qa mort-ora-y via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Does an array of a value type and a structure containing only that type
> have the same alignment requirements? That is, in C-syntax:
Yes, they're both derived from the DataLayout in a way that targets
cannot override.
> Does `array[0]` now refer to x, and `array[1]` to y?
Aside from array[1] being undefined behaviour n C, yes. The equivalent
is fine in LLVM of course, where types are punned merrily.
Cheers.
Tim.
More information about the llvm-dev
mailing list