Luigi Malagò | 5 Jan 19:25
Favicon

C++ parser: segmentation fault using parsing a file twice

hello to everybody,
i'm new to flex bison and i'm experiencing a strange problem. I have 
wirtten a C++ parser using
flex 2.5.33-r1 and bison 2.2. I have to parse two different files, with 
the same structure, so i decide to use the same parser twice.
The problem is that when i parse one file OR the other everything is ok, 
but when i parse both (no matter the order) or when i
parse one of the two twice, i get a segmentation fault. Using gdm i 
isolated the following code:

> Program received signal SIGSEGV, Segmentation fault.
> Error while running hook_stop:
> Invalid type combination in ordering comparison.
> 0x080600a8 in assoclex () at assocflex.c:935
> 935                     if ( 
> YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
> gdb> backtrace
> #0  0x080600a8 in assoclex () at assocflex.c:935
> #1  0x0805cf28 in assocparse () at assocgram.tab.c:1293
> #2  0x0805d614 in assoc_parser (bb=0x8070008) at assocgram.y:114
> #3  0x08049d7b in assocParser::parse (this=0x8070088, filename={static 
> npos = 0xffffffff, _M_dataplus = {<std::allocator<char>> = 
> {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data 
> fields>}, _M_p = 0x8070074 "ctof.txt"}}, bb=0x8070008) at 
> assocParser.cpp:28
> #4  0x08058b4c in main (argc=0x4, argv=0xbf8ce624) at main.cpp:85
> gdb> quit

The source code that seems to be problematic is the following 
(assocflex.c:935)
(Continue reading)


Gmane