changeset 93:08508eebbb3e trunk

[svn r97] Fixed bug with main(string[] args) on 32 bit systems. 64bit worked.
author lindquist
date Thu, 08 Nov 2007 19:21:05 +0100
parents 70d6113eeb8c
children 61615fa85940
files gen/tollvm.cpp
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gen/tollvm.cpp	Thu Nov 08 19:13:28 2007 +0100
+++ b/gen/tollvm.cpp	Thu Nov 08 19:21:05 2007 +0100
@@ -680,7 +680,9 @@
         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);