bug-bison
[Top][All Lists]
Advanced

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

Re: [GNU Bison 2.1] testsuite: 48 49 76 77 78 79 80 81 82 83 84 85 86 87


From: Paul Eggert
Subject: Re: [GNU Bison 2.1] testsuite: 48 49 76 77 78 79 80 81 82 83 84 85 86 87 88 89 116 120 121 122 123 124 125 126 127 128 130 failed
Date: Sun, 14 May 2006 02:00:44 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Bruno Haible <address@hidden> writes:

> When building GNU bison 2.1 with SunPRO C 5.9 and SunPRO C++ 5.9,
> "make check" fails 27 tests when an optimization of -xO4 or higher is used
> for the C compiler.

Thanks for reporting this.  I was able to reproduce the problem with
CVS Bison, but I'd guess it's a compiler bug.

The following patch worked around many (though not all) the test
failures for me, but as far as I can see the patch should not have
affected the meaning of the program.  This doesn't prove that it
is a compiler bug, but it's an indication.

Perhaps this should be reported to the Sun developers?  They can use
Bison 2.1 as a test case for their compiler.

2006-05-14  Paul Eggert  <address@hidden>

        Work around a bug in Sun C 5.9 Build18_0 2006/03/13 (GNU/Linux
        x86) with -xO4 or higher.  Problem reported by Bruno Haible in
        <http://lists.gnu.org/archive/html/bug-bison/2006-05/msg00014.html>.
        * data/glr.c (yygetLRActions): Return the action to take,
        rather than storing it through a pointer argument.  I don't
        know why this works around the compiler bug in many cases, but
        it does.  Unfortunately it does not work around the bug in all
        cases.  All callers changed.

--- glr.c.~1.172~       2006-05-14 01:21:23.000000000 -0700
+++ glr.c       2006-05-14 01:18:12.000000000 -0700
@@ -1034,7 +1034,7 @@ yydefaultAction (yyStateNum yystate)
         [YYID (0)],
         [((yytable_value) == YYTABLE_NINF)])[
 
-/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
+/** Return the action to take in YYSTATE on seeing YYTOKEN.
  *  Result R means
  *    R < 0:  Reduce on rule -R.
  *    R = 0:  Error.
@@ -1042,25 +1042,25 @@ yydefaultAction (yyStateNum yystate)
  *  Set *CONFLICTS to a pointer into yyconfl to 0-terminated list of
  *  conflicting reductions.
  */
-static inline void
+static inline int
 yygetLRActions (yyStateNum yystate, int yytoken,
-               int* yyaction, const short int** yyconflicts)
+               const short int** yyconflicts)
 {
   int yyindex = yypact[yystate] + yytoken;
   if (yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
     {
-      *yyaction = -yydefact[yystate];
       *yyconflicts = yyconfl;
+      return -yydefact[yystate];
     }
   else if (! yyis_table_ninf (yytable[yyindex]))
     {
-      *yyaction = yytable[yyindex];
       *yyconflicts = yyconfl + yyconflp[yyindex];
+      return yytable[yyindex];
     }
   else
     {
-      *yyaction = 0;
       *yyconflicts = yyconfl + yyconflp[yyindex];
+      return 0;
     }
 }
 
@@ -2038,7 +2038,7 @@ yyprocessOneStack (yyGLRStack* yystackp,
            }
          else
            yytoken = YYTRANSLATE (yychar);
-         yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts);
+         yyaction = yygetLRActions (yystate, yytoken, &yyconflicts);
 
          while (*yyconflicts != 0)
            {
@@ -2362,7 +2362,7 @@ b4_syncline(address@hidden@], address@hidden@])])dnl
                }
              else
                yytoken = YYTRANSLATE (yychar);
-             yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts);
+             yyaction = yygetLRActions (yystate, yytoken, &yyconflicts);
              if (*yyconflicts != 0)
                break;
              if (yyisShiftAction (yyaction))
@@ -2441,8 +2441,8 @@ b4_syncline(address@hidden@], address@hidden@])])dnl
              int yyaction;
              const short int* yyconflicts;
              yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState;
-             yygetLRActions (yystate, yytoken_to_shift, &yyaction,
-                             &yyconflicts);
+             yyaction = yygetLRActions (yystate, yytoken_to_shift,
+                                        &yyconflicts);
              /* Note that yyconflicts were handled by yyprocessOneStack.  */
              YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yys));
              YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);




reply via email to

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