From b32e04cacd80723abfc8f122dc76025e7d6158aa Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Thu, 8 Nov 2007 19:21:05 +0100 Subject: [PATCH] [svn r97] Fixed bug with main(string[] args) on 32 bit systems. 64bit worked. --- gen/tollvm.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gen/tollvm.cpp b/gen/tollvm.cpp index a55d5838..5e9b4477 100644 --- a/gen/tollvm.cpp +++ b/gen/tollvm.cpp @@ -680,7 +680,9 @@ void DtoMain() llvm::Value* arr = new llvm::AllocaInst(at->getContainedType(1)->getContainedType(0), func->arg_begin(), "argstorage", apt); llvm::Value* a = new llvm::AllocaInst(at, "argarray", apt); llvm::Value* ptr = DtoGEPi(a,0,0,"tmp",bb); - llvm::Value* v = new llvm::ZExtInst(args[0], DtoSize_t(), "tmp", bb); + llvm::Value* v = args[0]; + if (v->getType() != DtoSize_t()) + v = new llvm::ZExtInst(v, DtoSize_t(), "tmp", bb); new llvm::StoreInst(v,ptr,bb); ptr = DtoGEPi(a,0,1,"tmp",bb); new llvm::StoreInst(arr,ptr,bb);