# HG changeset patch # User Christian Kamm # Date 1217959812 -7200 # Node ID fc12214ba4a1405a1e5e78d0cba3a7429728be9e # Parent 672eb4893b55842cf072403c2897e366cb95ca48 Zero out padding of fp80. diff -r 672eb4893b55 -r fc12214ba4a1 gen/llvmhelpers.cpp --- a/gen/llvmhelpers.cpp Tue Aug 05 19:28:19 2008 +0200 +++ b/gen/llvmhelpers.cpp Tue Aug 05 20:10:12 2008 +0200 @@ -91,11 +91,22 @@ llvm::AllocaInst* DtoAlloca(const LLType* lltype, const std::string& name) { + if(lltype == LLType::X86_FP80Ty) + { + llvm::AllocaInst* alloca = new llvm::AllocaInst(lltype, name, gIR->topallocapoint()); + LLValue* castv = new llvm::BitCastInst(alloca, getPtrToType(LLType::Int16Ty), "fp80toi16", gIR->scopebb()); + LLValue* padding = DtoGEPi1(castv, 5, "fp80padding"); + new llvm::StoreInst(llvm::Constant::getNullValue(LLType::Int16Ty), padding, gIR->scopebb()); + + return alloca; + } + return new llvm::AllocaInst(lltype, name, gIR->topallocapoint()); } llvm::AllocaInst* DtoAlloca(const LLType* lltype, LLValue* arraysize, const std::string& name) { + assert(lltype != LLType::X86_FP80Ty && "Zero-init of fp80 padding for array allocas not yet implemented"); return new llvm::AllocaInst(lltype, arraysize, name, gIR->topallocapoint()); }