[cfe-commits] r43576 - /cfe/trunk/CodeGen/CodeGenTypes.cpp
Devang Patel
dpatel at apple.com
Wed Oct 31 14:01:37 PDT 2007
Author: dpatel
Date: Wed Oct 31 16:01:37 2007
New Revision: 43576
URL: http://llvm.org/viewvc/llvm-project?rev=43576&view=rev
Log:
Check whether next slot meets field type's alignment requirements.
If it does not then assert at the moment.
Modified:
cfe/trunk/CodeGen/CodeGenTypes.cpp
Modified: cfe/trunk/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenTypes.cpp?rev=43576&r1=43575&r2=43576&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/CodeGen/CodeGenTypes.cpp Wed Oct 31 16:01:37 2007
@@ -368,7 +368,10 @@
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);
More information about the cfe-commits
mailing list