[llvm-dev] [BUG] 3.8 alignment/struct padding
Tim Northover via llvm-dev
llvm-dev at lists.llvm.org
Tue Jun 28 12:07:05 PDT 2016
On 28 June 2016 at 11:59, Ramkumar Ramachandra via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I have what appears to be an alignment/struct padding bug. An i64 is not
> correctly aligned to the 8-byte boundary, and this results in a mismatched
> struct size between C and LLVM. We are currently running 3.8, and did not see
> this bug in 3.5.
LLVM needs to be provided with a datalayout to calculate correct
struct offsets, and for historical reasons the default alignment
requirement for i64 is only 32-bits. I suspect you're just relying on
this default, you should be able to crib the correct layout from a
Clang-compiled C file and use Module::setDataLayout to fix it.
More information about the llvm-dev