Fix alignment of interface info in class with align(1) members

GitHub: Fix #1058.
This commit is contained in:
David Nadlinger 2015-09-02 16:12:22 +03:00
parent accc420a07
commit 613781b13f
2 changed files with 13 additions and 1 deletions

View file

@ -337,6 +337,14 @@ void IrAggr::addFieldInitializers(
// has interface vtbls?
if (cd->vtblInterfaces && cd->vtblInterfaces->dim > 0)
{
// Align interface infos to pointer size.
unsigned aligned = (offset + Target::ptrsize - 1) & ~(Target::ptrsize - 1);
if (offset < aligned)
{
add_zeros(constants, offset, aligned);
offset = aligned;
}
// false when it's not okay to use functions from super classes
bool newinsts = (cd == aggrdecl->isClassDeclaration());