bug-bison
[Top][All Lists]
Advanced

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

$<out of range>


From: Akim Demaille
Subject: $<out of range>
Date: 25 Apr 2002 17:22:32 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

Hi!

Somewhere in the revamping of Bison, we broke something that is used
in GCC (this is CVS gcc/cp/parse.y, around line 2117).  Frankly, I'm
not ashamed to have broken it:

nomods_initdcl0:
          notype_declarator maybeasm
            { /* Set things up as initdcl0_innards expects.  */
              $<ttype>3 = $2;
              $2 = $1; 
              $<ftype>1.t = NULL_TREE;
              $<ftype>1.lookups = NULL_TREE; }
          initdcl0_innards 
            {}
        | constructor_declarator maybeasm maybe_attribute
                { tree d = parse_decl0 ($1, NULL_TREE, NULL_TREE, $3, 0);
                  parse_end_decl (d, NULL_TREE, $2); }
        ;

Bison now says:

gcc-20020415/gcc/cp % bison parse.y -v                           nostromo 17:14
parse.y:2120: invalid value: $3

It's not even clear to me what it is supposed to mean.  I suppose the
intend is to assign a value to the third symbol, which is the mid-rule
action, i.e., it is actually $$ which should be used.  And indeed, a
couple of lines above, one can read:

initdcl0_innards:
          maybe_attribute '='
                { $<ttype>$ = parse_decl0 ($<ttype>-1, $<ftype>-2.t,
                                           $<ftype>-2.lookups, $1, 1); }
          /* Note how the declaration of the variable is in effect
             while its init is parsed! */
          init
                { parse_end_decl ($<ttype>3, $4, $<ttype>0); }

Which shows the value of the mid-rule action _set_ ($$ = ...), and
used (last action, $3).


So, I hope POSIX declares this is an heresy, and assuming it does,
what is the proper decision to make?  Of course, we should tell the
GCC folks to fix their stuff, but, what about bison?



reply via email to

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