[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SEGV with lalr1.cc
From: |
Akim Demaille |
Subject: |
SEGV with lalr1.cc |
Date: |
Mon, 13 Jan 2003 16:42:21 +0100 |
User-agent: |
Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu) |
2003-01-13 Akim Demaille <address@hidden>,
Quoc Peyrot <address@hidden>,
Robert Anisko <address@hidden>
* data/lalr1.cc (parse::yyerrlab1): When popping the stack, stop
when the stacks contain one element, as the loop would otherwise
free the last state, and then use the top state (the one we just
popped). This means that the initial elements will not be freed
explicitly, as is the case in yacc.c; it is not a problem, as
these elements have fake values.
Index: data/lalr1.cc
===================================================================
RCS file: /cvsroot/bison/bison/data/lalr1.cc,v
retrieving revision 1.18
diff -u -u -r1.18 lalr1.cc
--- data/lalr1.cc 26 Dec 2002 08:27:09 -0000 1.18
+++ data/lalr1.cc 13 Jan 2003 15:41:06 -0000
@@ -302,7 +302,10 @@
int nerrs = 0;
int errstatus = 0;
- /* Initialize stack. */
+ /* Initialize the stacks. The initial state will be pushed in
+ yynewstate, since the latter expects the semantical and the
+ location values to have been already stored, initialize these
+ stacks with a primary value. */
state_stack_ = StateStack (0);
semantic_stack_ = SemanticStack (1);
location_stack_ = LocationStack (1);
@@ -545,7 +548,7 @@
}
/* Pop the current state because it cannot handle the error token. */
- if (!state_stack_.height ())
+ if (state_stack_.height () == 1)
goto yyabortlab;
#if YYDEBUG
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- SEGV with lalr1.cc,
Akim Demaille <=