Fixed segfault when using va_arg.

Fixed segfault when accessing function symbols from inline asm.
This commit is contained in:
Tomas Lindquist Olsen
2008-07-23 20:21:18 +02:00
parent c26f33f0bf
commit 100c42bca3
2 changed files with 7 additions and 3 deletions

View File

@@ -2036,7 +2036,9 @@ struct AsmProcessor
}
} 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;

View File

@@ -254,10 +254,12 @@ DValue* VarExp::toElem(IRState* p)
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())
{