summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Benkard <mulk@minimulk.mst-plus>2008-09-28 17:22:37 +0200
committerMatthias Benkard <mulk@minimulk.mst-plus>2008-09-28 17:22:37 +0200
commitb401e940be030bfd6d9e26f77a256ed6fc832931 (patch)
tree6a7ae966c2ccdc4b11d0c556a2d10b50e116b4dc
parent6299a2e95697c68c8b50f95e360e3ae367f6deb6 (diff)
LLVM compiler: Allocate va_list objects as i8** rather than i8*.
This fixes a terrible stack smashing bug that was most visible on PowerPC-based machines.
-rw-r--r--MLKLLVMCompiler.mm7
1 files changed, 4 insertions, 3 deletions
diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm
index 9e51112..b3a47d3 100644
--- a/MLKLLVMCompiler.mm
+++ b/MLKLLVMCompiler.mm
@@ -644,13 +644,14 @@ static Constant
false),
PointerType::get(Type::Int8Ty, 0));
- Value *ap = builder.CreateAlloca (Type::Int8Ty, NULL, "ap");
+ Value *ap = builder.CreateAlloca (PointerTy, NULL, "ap");
+ Value *ap2 = builder.CreateBitCast (ap, PointerTy);
builder.CreateCall (module->getOrInsertFunction ("llvm.va_start",
Type::VoidTy,
PointerTy,
NULL),
- ap);
+ ap2);
Value *mlkcons = [_compiler insertClassLookup:@"MLKCons"];
@@ -707,7 +708,7 @@ static Constant
Type::VoidTy,
PointerTy,
NULL),
- ap);
+ ap2);
if ([_bodyContext variableHeapAllocationForSymbol:_lambdaListName])
{