<span>I have a struct node with three fields {size_t, size_t, struct node <span class="chatzilla-bold">*}. When I allocate such a node, malloc allocates [3*</span> i64] i.e   allocates an array of 3 i64's but not a structure. <br>
Thus any store to the pointer field in the structures involves a cast from a pointer to an integer.<br>So a pointer is cast to a integer and then stored into the third field of this structure. <br>This happens only when I use llvm-gcc -O3 to generate the bitcode? why does llvm-gcc do this with -O3?</span><br clear="all">
<br>Sample bitcode illustrating the same is shown below.<br><br>        %2 = malloc [3 x i64]           ; <[3 x i64]*> [#uses=6]
<br>        %.sub = getelementptr [3 x i64]* %2, i64 0, i64 0               ; <i64*> [#uses=\
<br>1]
<br>        store i64 %i.0.reg2mem.0, i64* %.sub, align 8
<br>        %3 = getelementptr [3 x i64]* %2, i64 0, i64 1          ; <i64*> [#uses=1]
<br>        %.c = add i64 %i.0.reg2mem.0, 1         ; <i64> [#uses=3]
<br>        store i64 %.c, i64* %3
<br>        %4 = getelementptr [3 x i64]* %2, i64 0, i64 2          ; <i64*> [#uses=1]
<br>        %ptr.0.c = ptrtoint [3 x i64]* %ptr.0.in.in.reg2mem.0 to i64            ; <i64> \
<br>[#uses=1]
<br>        store i64 %ptr.0.c, i64* %4
<br><br><br>Santosh<br><br>