[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
C++ parser: segmentation fault using parsing a file twice
From: |
Luigi Malagò |
Subject: |
C++ parser: segmentation fault using parsing a file twice |
Date: |
Fri, 05 Jan 2007 18:26:54 +0000 |
User-agent: |
Mozilla Thunderbird 1.5.0.8 (X11/20061202) |
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)
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
{
/* We're scanning a new file or input source. It's
* possible that this happened because the user
* just pointed associn at a new source and called
* assoclex(). If so, then we have to assure
* consistency between YY_CURRENT_BUFFER and our
* globals. Here is the right place to do so, because
* this is the first action (other than possibly a
* back-up) that will match for the new input source.
*/
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
YY_CURRENT_BUFFER_LVALUE->yy_input_file = associn;
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
}
Finally this is my part of my code:
void assoc_parser(brianBehaviors *bb) {
assocparser_linenumber = 2;
// sl = new assoc_list();
// s = new assoc();
assoc_init();
//assocdebug=1;
assoc_bbehavior = bb;
assoc_v = new variable();
printf("ready to parse...\n");
assocparse();
printf("...parsing done\n");
delete assoc_v;
assoc_cancel_memory_leaks();
}
Hope someone can help me.
Luigi
--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
Sponsor:
Refill srl il paradiso della tua stampante - cartucce e toner compatibili,
inchiostri e accessori per la ricarica, carta speciale. Tutto a prezzi
scontatissimi!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=5187&d=5-1
- C++ parser: segmentation fault using parsing a file twice,
Luigi Malagò <=