chromatic wrote:
On Thursday 29 November 2007 20:34:17 Will Coleda wrote:

On feather, languages/c99 (et al.) fail with:

$ make
../../parrot -o src/CPP_PGE2AST.pbc --output-pbc src/CPP_PGE2AST.pir
*** glibc detected *** ../../parrot: double free or corruption
(fasttop): 0x0823e328 ***

running this through gdb, I get:

bt
#0  0xb7f41402 in __kernel_vsyscall ()
#1  0xb6f77a85 in raise () from /lib/i686/nosegneg/libc.so.6
#2  0xb6f794e1 in abort () from /lib/i686/nosegneg/libc.so.6
#3  0xb6faf7dc in __libc_message () from /lib/i686/nosegneg/libc.so.6
#4  0xb6fb7755 in _int_free () from /lib/i686/nosegneg/libc.so.6
#5  0xb6fbb270 in free () from /lib/i686/nosegneg/libc.so.6
#6  0xb7e75ad5 in read_macro (valp=0xbfc40c4c, interp=0x804f008,
     yyscanner=0x8235678) at compilers/imcc/imcc.l:888
#7  0xb7e71d71 in yylex (valp=0xbfc40c4c, yyscanner=0x8235678,
interp=0x804f008)
     at compilers/imcc/imcc.l:385
#8  0xb7e6b85d in yyparse (yyscanner=0x8235678, interp=0x804f008)
     at compilers/imcc/imcparser.c:2598
#9  0xb7e7856a in compile_to_bytecode (interp=0x804f008,
     sourcefile=0xbfc41bb5 "src/CPP_PGE2AST.pir",
     output_file=0xbfc41b94 "src/CPP_PGE2AST.pbc") at compilers/imcc/
main.c:960
#10 0xb7e788f6 in imcc_run (interp=0x804f008,
     sourcefile=0xbfc41bb5 "src/CPP_PGE2AST.pir", argc=1,
argv=0xbfc40ec4)
     at compilers/imcc/main.c:1060
#11 0x0804896d in main (argc=1, argv=0xbfc40ec4) at src/main.c:62

compilers/imcc/imcc.l:888 seems to be where it goes off the rails..

IANACP, but there seems to be several calls to 'free(valp->s)' in
that function that aren't careful about not freeing that pointer more
than once.

I think this is the same as "[perl#51104][BUG] bad pointer! segfaults are bad!".

The issue seems to be caused by languages/c99/src/preamble, where:

.local $iter_loop:

Consider this test program.

$cat m.pir
.macro test
.local $iter_loop:
.endm

$ parrot -o m.pbc --output-pbc m.pir
compilers/imcc/imcc.l:992: failed assertion 'valp->s'

(Remove the colon and it parses again.)

I could track it down as far as read_macro in imcc.l, where line 1015
does not fill valp, and returns the token MACRO.

c = yylex(valp, yyscanner, interp);

Ron

Reply via email to