[TRE-general] Weird bug
skaller
skaller at users.sourceforge.net
Mon May 15 07:36:34 EEST 2006
I am getting a weird bug terminating Felix.
This program runs all the way through, then segfaults:
---------------------------------------------------------
#import <flx.flxh>
open C_hack;
header '#include "tre/tre_regex.hpp"';
type tre_regexp = "regex_t";
fun flx_regcomp: ptr[tre_regexp] * string * int -> int =
"regcomp($1,$2.data(),$3)"
;
fun regcomp (inp : string): opt[tre_regexp] =
{
var cr : tre_regexp;
res := flx_regcomp(addr cr, inp, 0);
return
match res with
| 0 => Some cr
| _ => None[tre_regexp]
endmatch
;
}
var r = regcomp("(a|b)*abb");
print "Done tre compile"; endl;
print
match r with
| Some _ => "Compiled"
| None => "failed"
endmatch
;
endl;
print "Finished"; endl;
--------------------------------------------
bin/flx: line 522: 25204 Segmentation fault env FLX_DEBUG=1 ./aa
skaller at rosella:/work/felix/flx$ FLX_DEBUG=1 bin/flx --test --static
--echo --debug ./aa
TESTMODE: running felix from .
env FLX_DEBUG=1 ./aa
[FLX_DEBUG] Debug enabled for static link program
[FLX_DEBUG_ALLOCATIONS] Allocation debug enabled
[FLX_DEBUG_COLLECTIONS] Collection debug enabled
[FLX_DEBUG_DRIVER] Driver debug enabled
[FLX_FINALISE] Finalisation Disabled
[FLX_COMPACT] Compaction initially OFF
[FLX_GC_FREQ] call gc every 1000 iterations
Compiled by g++
Stack pointer = 0x7fffff97b440, frame=0x2aaaab3a8738,
return=0x2aaaab1904bbflx_argv[0]->./aa
flx_run driver begins ./aa
Malloc 112 bytes, address = 0x5a7510
Allocated 0x5a7540-0x30= new thread_frame_t
Malloc 64 bytes, address = 0x631cf0
Allocated 0x631d20-0x30= new _a2642t_3886
Done tre compile
Compiled
Finished
bin/flx: line 438: 25206 Segmentation fault env FLX_DEBUG=1 ./aa
--------------------------------------------------------
All the test programs run OK, so this is weird.
If I comment out the call to regcomp, it terminates ok.
This is using the tre 0.7.3 (NOT the C++ version in Felix).
Running on Ubuntu/Linux x86_64.
This looks like tre is corrupting memory.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
More information about the TRE-general
mailing list