From 835e972e6bc963bf37be81106635c800ae6c6b66 Mon Sep 17 00:00:00 2001 From: kai Date: Fri, 25 Oct 2013 16:15:52 +0200 Subject: [PATCH] Fix va_arg handling. The change of symbol emission ignored the fact that the va_arg intrinsic must be handled in a special way. This commit corrects the omission (which leads to seg faults on Linux/PPC64). --- gen/llvmhelpers.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index d7170fe3..0819f2ed 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -1916,7 +1916,8 @@ DValue* DtoSymbolAddress(const Loc& loc, Type* type, Declaration* decl) fatal(); } DtoResolveFunction(fdecl); - return new DFuncValue(fdecl, fdecl->ir.irFunc->func); + assert(fdecl->llvmInternal == LLVMva_arg || fdecl->ir.irFunc); + return new DFuncValue(fdecl, fdecl->ir.irFunc ? fdecl->ir.irFunc->func : 0); } if (SymbolDeclaration* sdecl = decl->isSymbolDeclaration()) @@ -2028,4 +2029,4 @@ FuncDeclaration* getParentFunc(Dsymbol* sym, bool stopOnStatic) { } return (parent ? parent->isFuncDeclaration() : NULL); -} \ No newline at end of file +}