Struct init codegen and padding

This test program crashes in CodeGen.
struct s { short a; int b; } x = {1, 1};

"struct s" converts to LLVM type {i16, i8, i8, i32}, padded with i8.
CodeGen attempts llvm::ConstantStruct::get({i16, i8, i8, i32}, {1, 1})
and crashes, since the type has 4 elements but initializer has only 2.

Here's a fix. It doesn't completely implement struct initializer
codegen, but it's enough to codegen all fully braced initializers that
don't initialize bitfields.


structinitcodegen.txt (4.39 KB)