mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
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
This commit is contained in:
parent
9101d8647f
commit
44f5fb46b0
@ -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));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user