[LLVMdev] LLI Segfaulting
Duncan Sands
baldrick at free.fr
Mon Mar 12 05:57:36 PDT 2012
Hi Fraser, it looks to me like you are smashing the stack.
> define void @main() nounwind {
> allocas:
> %0 = alloca { i32, [0 x i32] }, align 8
^ this allocates 4 bytes on the stack.
> %2 = getelementptr inbounds { i32, [0 x i32] }* %0, i64 0, i32 1
^ this gets a pointer to the byte after the 4 allocated bytes.
> %3 = bitcast [0 x i32]* %2 to i8*
> call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* bitcast ([5 x i32]*
> @.gvar_array to i8*), i64 20, i32 4, i1 false)
This copies 20 bytes there, kaboom!
Ciao, Duncan.
More information about the llvm-dev
mailing list