mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-06 10:57:35 +03:00
Fix alignment of interface info in class with align(1) members
GitHub: Fix #1058.
This commit is contained in:
parent
accc420a07
commit
613781b13f
2 changed files with 13 additions and 1 deletions
|
@ -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());
|
||||
|
||||
|
|
|
@ -192,7 +192,11 @@ void AggrTypeBuilder::addAggregate(AggregateDeclaration *ad)
|
|||
|
||||
void AggrTypeBuilder::alignCurrentOffset(unsigned alignment)
|
||||
{
|
||||
m_offset = (m_offset + alignment - 1) & ~(alignment - 1);
|
||||
unsigned aligned = (m_offset + alignment - 1) & ~(alignment - 1);
|
||||
if (m_offset < aligned) {
|
||||
m_fieldIndex += add_zeros(m_defaultTypes, m_offset, aligned);
|
||||
m_offset = aligned;
|
||||
}
|
||||
}
|
||||
|
||||
void AggrTypeBuilder::addTailPadding(unsigned aggregateSize)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue