bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug with '#line' directive in bison 3.0.2


From: Stephen Cameron
Subject: Bug with '#line' directive in bison 3.0.2
Date: Sun, 28 Sep 2014 20:43:55 -0500

Hi,

I think I have found a bug in bison v. 3.0.2.

address@hidden ~/github/simple-expression-parser $ yacc --version
bison (GNU Bison) 3.0.2
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
address@hidden ~/github/simple-expression-parser $

Note that is the version of bison shipped with e.g. Linux Mint 17.

Below is some output (y.tab.h) of yacc (bison) v 3.0.2

Notice the '#line' directive which does not start at the beginning of a
line:

"union #line 49 "expression-parser.y" /* yacc.c:1909  */"

gcc will not compile this.  I think that means it's a bug in bison.
Earlier versions of bison produce correct output (e.g. v. 2.5 works
correctly, and the '#line' directive begins on a new line.)

-------8<--------8<-------8<-------8<--------8<-------8<-------8<--------8<-------8<
[...]
/* Value type.  */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union #line 49 "expression-parser.y" /* yacc.c:1909  */
valtype
 YYSTYPE;
union #line 49 "expression-parser.y" /* yacc.c:1909  */
valtype

{
#line 49 "expression-parser.y" /* yacc.c:1909  */

        struct parser_value_type {
                double dval;
                long long ival;
                int has_dval;
                int has_error;
        } v;

#line 77 "y.tab.h" /* yacc.c:1909  */
};
# define YYSTYPE_IS_TRIVIAL 1
[...]
-------8<--------8<-------8<-------8<--------8<-------8<-------8<--------8<-------8<

The program which caused this is a simple arithmetic expression parser
(basic yacc 101 stuff).  It is here:
https://github.com/smcameron/simple-expression-parser

Thank you.

-- steve


reply via email to

[Prev in Thread] Current Thread [Next in Thread]