Mercurial > projects > ldc
changeset 384:3f98d46e05a4
Fixed segfault when using va_arg.
Fixed segfault when accessing function symbols from inline asm.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 23 Jul 2008 20:21:18 +0200 |
parents | c028fd91b3b0 |
children | 1fd4cacea60e |
files | gen/d-asm-i386.h gen/toir.cpp |
diffstat | 2 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/d-asm-i386.h Wed Jul 23 18:53:44 2008 +0200 +++ b/gen/d-asm-i386.h Wed Jul 23 20:21:18 2008 +0200 @@ -2036,7 +2036,9 @@ } } else if (exp->op == TOKvar) { VarDeclaration * v = ((VarExp *) exp)->var->isVarDeclaration(); - v->needsStorage = true; + if (v) { + v->needsStorage = true; + } if (v && v->storage_class & STCfield) { operand->constDisplacement += v->offset;
--- a/gen/toir.cpp Wed Jul 23 18:53:44 2008 +0200 +++ b/gen/toir.cpp Wed Jul 23 20:21:18 2008 +0200 @@ -254,10 +254,12 @@ else if (FuncDeclaration* fdecl = var->isFuncDeclaration()) { Logger::println("FuncDeclaration"); - if (fdecl->llvmInternal != LLVMva_arg) {// && fdecl->llvmValue == 0) + LLValue* func = 0; + if (fdecl->llvmInternal != LLVMva_arg) { DtoForceDeclareDsymbol(fdecl); + func = fdecl->ir.irFunc->func; } - return new DFuncValue(fdecl, fdecl->ir.irFunc->func); + return new DFuncValue(fdecl, func); } else if (SymbolDeclaration* sdecl = var->isSymbolDeclaration()) {