Hi everyone, I think I have found a bug on Libjit which tries to read from memory not allocated. I am using the Libjit from the GIT repository; unfortunately this bug shows only when I compile complicated program in ILDJIT (hence, I could not find a simple test case).
Consider that no other memory error appears on the execution outside Libjit (for that reason I think it is a bug of Libjit and not of ILDJIT).
The "guilty" lines are the following:
Line: jit_insn_branch_if (jit-insn.c:3681). Message from valgrind:
Invalid read of size 4 ==1632== Address 0x167c5518 is 56 bytes inside a block of size 64 free'd
==1632== at 0x4024D12: realloc (vg_replace_malloc.c:476)
==1632== by 0x432B673: jit_realloc (jit-alloc.c:114)
==1632== by 0x432DB7C: _jit_block_add_insn (jit-block.c:852)
==1632== by 0x433ABC6: jit_insn_branch_if (jit-insn.c:3675)
Line: jit_insn_branch_if (jit-insn.c:3682). Message from valgrind:
==1632== Invalid read of size 4
==1632== at 0x433ABE9: jit_insn_branch_if (jit-insn.c:3682) ==1632== Address 0x167c551c is 60 bytes inside a block of size 64 free'd
==1632== at 0x4024D12: realloc (vg_replace_malloc.c:476) ==1632== by 0x432B673: jit_realloc (jit-alloc.c:114)
==1632== by 0x432DB7C: _jit_block_add_insn (jit-block.c:852) ==1632== by 0x433ABC6: jit_insn_branch_if (jit-insn.c:3675)
Line: jit_insn_branch_if_not (jit-insn.c:3899). Message from valgrind:
==1632== Invalid read of size 4
==1632== at 0x433A65C: jit_insn_branch_if_not (jit-insn.c:3899)
==1632== Address 0x16c2e750 is 56 bytes inside a block of size 64 free'd
==1632== at 0x4024D12: realloc (vg_replace_malloc.c:476)
==1632== by 0x432B673: jit_realloc (jit-alloc.c:114)
==1632== by 0x432DB7C: _jit_block_add_insn (jit-block.c:852)
==1632== by 0x433A616: jit_insn_branch_if_not (jit-insn.c:3888)
Line: jit_insn_branch_if_not (jit-insn.c:3900). Message from valgrind:
==1632== Invalid read of size 4
==1632== at 0x433A665: jit_insn_branch_if_not (jit-insn.c:3900)
==1632== Address 0x16c2e754 is 60 bytes inside a block of size 64 free'd
==1632== at 0x4024D12: realloc (vg_replace_malloc.c:476)
==1632== by 0x432B673: jit_realloc (jit-alloc.c:114)
==1632== by 0x432DB7C: _jit_block_add_insn (jit-block.c:852)
==1632== by 0x433A616: jit_insn_branch_if_not (jit-insn.c:3888)
and others that I do not report here because they are related to the ones above.
I really hope I am useful for the Libjit project.
Thanks to every one for your hard work on Libjit. Simone Campanoni