bison-patches
[Top][All Lists]
Advanced

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

Re: unsigned int = -1


From: Paul Eggert
Subject: Re: unsigned int = -1
Date: 26 Apr 2003 23:00:09 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Alexandre Duret-Lutz writes:

> ~/tmp % cat test.yy
> %token FOO
> %%
> all: FOO
> ~/tmp % bison --skeleton=lalr1.cc test.yy
> ~/tmp % grep 'unsigned.*-1' test.tab.cc
> const unsigned char yy::Parser::table_ninf_ = -1;

Thanks for reporting this.  I installed this patch:

2003-04-26  Paul Eggert  <address@hidden>

        * data/lalr1.cc (yy::Parser::pact_ninf_, yy::Parser::table_ninf_):
        Declare to be of type suitable for the ninf value itself, not of
        type suitable for the corresponding table, since the latter might
        be unsigned but the ninf value might be negative.  This fixes a
        bug reported by Alexandre Duret-Lutz in
        <http://mail.gnu.org/archive/html/bug-bison/2003-04/msg00017.html>.

--- data/lalr1.cc       2 Mar 2003 13:39:44 -0000       1.30
+++ data/lalr1.cc       27 Apr 2003 05:56:34 -0000      1.31
@@ -209,12 +209,12 @@ namespace yy
 
     /* Tables.  */
     static const ]b4_int_type_for([b4_pact])[ pact_[];
-    static const ]b4_int_type_for([b4_pact])[ pact_ninf_;
+    static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ pact_ninf_;
     static const ]b4_int_type_for([b4_defact])[ defact_[];
     static const ]b4_int_type_for([b4_pgoto])[ pgoto_[];
     static const ]b4_int_type_for([b4_defgoto])[ defgoto_[];
     static const ]b4_int_type_for([b4_table])[ table_[];
-    static const ]b4_int_type_for([b4_table])[ table_ninf_;
+    static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ table_ninf_;
     static const ]b4_int_type_for([b4_check])[ check_[];
     static const ]b4_int_type_for([b4_r1])[ r1_[];
     static const ]b4_int_type_for([b4_r2])[ r2_[];
@@ -639,7 +639,7 @@ yy::]b4_parser_class_name[::lex_ ()
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-const ]b4_int_type_for([b4_pact]) yy::b4_parser_class_name::pact_ninf_ = 
b4_pact_ninf[;
+const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) 
yy::b4_parser_class_name::pact_ninf_ = b4_pact_ninf[;
 const ]b4_int_type_for([b4_pact])[
 yy::]b4_parser_class_name[::pact_[] =
 {
@@ -672,7 +672,7 @@ yy::]b4_parser_class_name[::defgoto_[] =
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
    number is the opposite.  If zero, do what YYDEFACT says.  */
-const ]b4_int_type_for([b4_table]) yy::b4_parser_class_name::table_ninf_ = 
b4_table_ninf[;
+const ]b4_int_type(b4_table_ninf, b4_table_ninf) 
yy::b4_parser_class_name::table_ninf_ = b4_table_ninf[;
 const ]b4_int_type_for([b4_table])[
 yy::]b4_parser_class_name[::table_[] =
 {




reply via email to

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