aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachOWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/MachOWriter.cpp')
-rw-r--r--lib/CodeGen/MachOWriter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/MachOWriter.cpp b/lib/CodeGen/MachOWriter.cpp
index 3beb11a25f..384dd3ee54 100644
--- a/lib/CodeGen/MachOWriter.cpp
+++ b/lib/CodeGen/MachOWriter.cpp
@@ -878,7 +878,8 @@ void MachOWriter::InitMem(const Constant *C, void *Addr, intptr_t Offset,
const StructLayout *SL =
TD->getStructLayout(cast<StructType>(CPS->getType()));
for (unsigned i = 0, e = CPS->getNumOperands(); i != e; ++i)
- WorkList.push_back(CPair(CPS->getOperand(i), PA+SL->MemberOffsets[i]));
+ WorkList.push_back(CPair(CPS->getOperand(i),
+ PA+SL->getElementOffset(i)));
} else {
cerr << "Bad Type: " << *PC->getType() << "\n";
assert(0 && "Unknown constant type to initialize memory with!");