[gnu.utils.bug] bison-1.03 bug

fox@allegra.att.com (11/16/89)

I have just learned that if a grammar contains useless nonterminals
it will not work properly.  Here is the last entry in the change log:

	Wed Aug 23 15:03:07 1989  Jay Fenlason  (hack at gnu)
        	* Makefile: Include system.h in bison-dist.tar

Here is an input file that provides evidence of the bug:

------------- Cut here ---------------
%token sym5
%token sym6
%token sym7
%token sym8
%token sym9
%token sym0

%%

sym1:
          sym3
        | sym4
        ;

sym2:
          sym5
        | sym6
        ;

sym3:
          sym7
        | sym8
        ;

sym4:
          sym9
        | sym0
        ;
------------------------------

And here is the evidence: incorrect entries in yyrline[]:


	static const short yyrline[] = {     0,
	    10,    12,    15,    17,    20,    22
	};

The sym2: rule is useless, but its lines appear in the array
and those of sym4 do not.  Note that it is not only yydebug
output that is incorrect; such parsers do not parse correctly.

Thanks,

David Fox
fox@allegra.att.com
fox@cs.columbia.edu