diff options
author | Jeff Cohen <jeffc@jolt-lang.org> | 2007-04-09 19:26:30 +0000 |
---|---|---|
committer | Jeff Cohen <jeffc@jolt-lang.org> | 2007-04-09 19:26:30 +0000 |
commit | 44f5fb46b0dfed4b949422eee5d38abecd51dab6 (patch) | |
tree | 72fe2e0741478f917659763440a58561e8102b34 /lib/Target/TargetData.cpp | |
parent | 9101d8647fbd2d9286fbf8224388557b30a18537 (diff) |
When the number of elements is zero, don't malloc 32GB on 64-bit systems.
Fixes unexpected failures on FreeBSD/amd64 of:
CFrontend/2005-09-24-BitFieldCrash.c:
CFrontend/2007-02-04-EmptyStruct.c:
CFrontend/2007-03-26-ZeroWidthBitfield.c:
CodeGen/Generic/2005-10-18-ZeroSizeStackObject.ll:
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35828 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetData.cpp')
-rw-r--r-- | lib/Target/TargetData.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index b1f08079f0..10ee707aea 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -342,7 +342,7 @@ const StructLayout *TargetData::getStructLayout(const StructType *Ty) const { // Otherwise, create the struct layout. Because it is variable length, we // malloc it, then use placement new. - unsigned NumElts = Ty->getNumElements(); + int NumElts = Ty->getNumElements(); StructLayout *L = (StructLayout *)malloc(sizeof(StructLayout)+(NumElts-1)*sizeof(uint64_t)); |