union u{
char ch[41];
int b[10];
}un;
The LLVM compiles to this
%union.u = type { [10 x i32], [4 x i8] }
and this
union un{
struct s{
int a;
float f;
double d;
}st;
int intArr[10];
}uno;
compiles to this
%union.un = type { %struct.s, [24 x i8] }
%struct.s = type { i32, float, double }
Can any one explain how the union type is derived ?
The first member is just the most aligned member of the union (it arbitrarily picks one if there are multiple such members), and an array of i8 is appended to make it the right size.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With