helpbison - Support: sr #108481, Assertion `!yytname_' failed.


sr #108481: Assertion `!yytname_' failed.

Submitted by:  None
Submitted on:  Thu 23 Jan 2014 04:30:53 PM UTC  
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Done
Privacy:  Public Assigned to:  Akim Demaille <akim>
Originator Email:  -email is unavailable- Open/Closed:  Closed
Operating System:  GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 09 Jan 2015 08:14:13 AM UTC, comment #4:

Thanks to both of you for the bug report, and patch proposal.

Based on that, I have sent yesterday a series of patch to address this. I hope I will release Bison 3.0.3 this month.

Please, have a look here:


Akim Demaille <akim>
Project AdministratorIn charge of this item.
Tue 27 May 2014 12:11:01 PM UTC, comment #3:

Never be lazy :-(

Since the patch is only 3 line long, I thought it would be correct to put it in my mail... Here it is as attachment.

(file #31446)

Michel DHOOGE <mdhooge>
Tue 27 May 2014 12:08:03 PM UTC, comment #2:

I created a patch that permanently solves the problem. But I'm not sure this is the best option. I think an intermediate method that avoid to duplicate the destruction code would be much better.

      • /home/michel/dev_3rd/bison/data/ 2014-05-25 12:14:08.268061947 +0200

--- /usr/share/bison/ 2014-05-27 14:00:01.202047507 +0200

                              • b4_dollar_popdef])[]dnl
      • 891,896 ****

--- 891,900 ----
yy_destroy_ ("Error: discarding", yyla);
yyempty = true;
+ // Type destructor.
+ symbol_number_type yytype = yyla.type_get ();
+ ]b4_symbol_variant([[yytype]], [[yyla.value]], [[template destroy]])[

Michel DHOOGE <mdhooge>
Sun 25 May 2014 06:12:40 PM UTC, comment #1:


I tracked this bug down and found a workaround...

In, the yyerrlab section has the following code:
yy_destroy_ ("Error: discarding", yyla);
yyempty = true;

Unfortunately, this isn't enough to really destroy the semantic_type value of the yyla variable (yy_destroy_ only prints a message). But the yyempty variable is still set to false.

So, when a new token is read, the following lines trigger the assertion of this bug report:
symbol_type yylookahead (yylex ());
yyla.move (yylookahead);

First, I tried to copy the code of basic_symbol<Base>::~basic_symbol directly into the yy_destroy function. But this breaks code that pop the stack.

So my workaround is to copy/paste/adapt the basic_symbol<Base>::~basic_symbol code into the yyerrlab discarding block.

Michel DHOOGE <mdhooge>
Thu 23 Jan 2014 04:30:53 PM UTC, original submission:

Hi all,
I was testing error recovery with bison and I'm getting this assertion here:

/// Instantiate an empty \a T in here.
template <typename T>
build ()
YYASSERT (!yytname_);
YYASSERT (sizeof (T) <= S);
yytname_ = typeid (T).name ();
return *new (yyas_<T> ()) T;
when using this simple grammar.

%token <char> CHAR "char"
%token <int> NUM "number"
%token SEMICOLON ";"
%token END 0 "end of file"


stms : stms CHAR ";"
| CHAR ";"
| error ";" {yyerrok;}


I've used bison 3.0.2 and flex 2.5.37.
I'm attaching all the code I used with this test.

I was expecting two error messages, and in fact I get those messages when I remove the parse.assert definition.

I used g++ *.cpp -o test to compile the code, after bison and flex.




(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #31446: added by mdhooge (526B - text/x-patch)
file #30354: added by None (34KiB - application/octet-stream - Example to reproduce the problem)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by akim (Posted a comment)
  • -email is unavailable- added by mdhooge (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-01-09 akim StatusNone => Done
        Assigned toNone => akim
        Open/ClosedOpen => Closed
    2014-05-27 mdhooge Attached File- => Added, #31446
    2014-01-23 None Attached File- => Added, #30354

    Back to the top

    Powered by Savane 3.3