Check whether next slot meets field type's alignment requirements.

If it does not then assert at the moment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43576 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2007-10-31 21:01:37 +00:00
Родитель b4292f221f
Коммит 9e124d96ab
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -368,7 +368,10 @@ void RecordOrganizer::layoutStructFields(CodeGenTypes &CGT,
const llvm::Type *Ty = CGT.ConvertType(FD->getType());
uint64_t Offset = RL.getFieldOffset(FieldNo);
assert (Offset == Cursor && "FIXME Invalid struct layout");
unsigned align = CGT.getTargetData().getABITypeAlignment(Ty);
if (Cursor % align != 0)
assert (Offset == Cursor && "FIXME Invalid struct layout");
Cursor += CGT.getTargetData().getTypeSizeInBits(Ty);
Fields.push_back(Ty);