From 0eea9f92b4972bbdf63a6ec97a2a85107c07d7ee Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 12 Apr 2010 21:10:05 +0000 Subject: 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 --- lib/CodeGen/CGExprConstant.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/CGExprConstant.cpp') 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); } -- cgit v1.2.3