Displaying 7 results from an estimated 7 matches for "gvar_array".
2012 Mar 12
2
[LLVMdev] LLI Segfaulting
...9;,
and prints out an element of it.
Note that the print statement is irrelevant here, it segfaults regardless,
and this code has been run with -O2 optimization level, but segfaults either
way (the code is just a lot shorter and easier to post this way)
%MainClass = type { { i32, [0 x i32] } }
@.gvar_array = private unnamed_addr constant [5 x i32] [i32 1, i32 2, i32 3,
i32 4, i32 5]
define void @"MainClass::<init>()"(%MainClass* nocapture %this_ptr) nounwind
{
allocas:
%0 = getelementptr inbounds %MainClass* %this_ptr, i64 0, i32 0, i32 0
store i32 5, i32* %0, align 4
%1 = gete...
2012 Mar 12
2
[LLVMdev] LLI Segfaulting
...gt;
>> %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!
>
Such a painfully obvious answer, thank you! I'm assuming this is what
happens when I use the unoptimized version of the code and call
> %0 = alloca %MainClass
then transfer the array into that. If I&...
2012 Mar 12
0
[LLVMdev] LLI Segfaulting
...is 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.
2012 Mar 12
2
[LLVMdev] LLI Segfaulting
...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!
>>>
>>
>> Such a painfully obvious answer, thank you! I'm assuming this is what
>> happens when I use the unoptimized version of the code and call
>>
>>>...
2012 Mar 12
0
[LLVMdev] LLI Segfaulting
...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!
>>
>
> Such a painfully obvious answer, thank you! I'm assuming this is what
> happens when I use the unoptimized version of the code and call
>
>> %0 = alloca %MainClass
>...
2012 Mar 12
0
[LLVMdev] LLI Segfaulting
..., 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!
> >>>
> >>
> >> Such a painfully obvious answer, thank you! I'm assuming this is what
> >> happens when I use the unoptimized version of the code and...
2012 Mar 12
1
[LLVMdev] LLI Segfaulting
...;> >>> ^ 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!
>> >>>
>> >>
>> >> Such a painfully obvious answer, thank you! I'm assuming this is what
>> >> happens when I use the unoptimized...