diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-12 21:10:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-12 21:10:05 +0000 |
commit | 0eea9f92b4972bbdf63a6ec97a2a85107c07d7ee (patch) | |
tree | 04f6cd164f9149285f3fd67627d90b65fb206d78 /lib/CodeGen/CGExprConstant.cpp | |
parent | 9b28daf9b6ea3808ef6b63408c24095a43d48018 (diff) |
fix PR6660/6168: emit padding as zeros instead of undef. Because
trailing fields may not be represented in initializer lists, they
are being handled as padding and those fields *must* be zero
initialized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101067 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r-- | lib/CodeGen/CGExprConstant.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 172a77d78e..c57cf5b7b6 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -231,7 +231,7 @@ class ConstStructBuilder { if (NumBytes > 1) Ty = llvm::ArrayType::get(Ty, NumBytes); - llvm::Constant *C = llvm::UndefValue::get(Ty); + llvm::Constant *C = llvm::Constant::getNullValue(Ty); Elements.push_back(C); assert(getAlignment(C) == 1 && "Padding must have 1 byte alignment!"); @@ -269,7 +269,7 @@ class ConstStructBuilder { if (NumBytes > 1) Ty = llvm::ArrayType::get(Ty, NumBytes); - llvm::Constant *Padding = llvm::UndefValue::get(Ty); + llvm::Constant *Padding = llvm::Constant::getNullValue(Ty); PackedElements.push_back(Padding); ElementOffsetInBytes += getSizeInBytes(Padding); } @@ -509,7 +509,7 @@ public: if (NumPadBytes > 1) Ty = llvm::ArrayType::get(Ty, NumPadBytes); - Elts.push_back(llvm::UndefValue::get(Ty)); + Elts.push_back(llvm::Constant::getNullValue(Ty)); Types.push_back(Ty); } |