bug-bison
[Top][All Lists]
Advanced

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

Re: SEGV running tests on IRIX 6.5.19m


From: Albert Chin-A-Young
Subject: Re: SEGV running tests on IRIX 6.5.19m
Date: Wed, 26 May 2004 17:47:34 -0500
User-agent: Mutt/1.5.6i

On Wed, May 26, 2004 at 01:43:01PM -0700, Paul Eggert wrote:
> address@hidden (Albert Chin-A-Young) writes:
> 
> >    3 quotearg_n_style(n = 3, s = escape_quoting_style=4, arg = 0x1) 
> > ["/opt/build/bison-1.875d/lib/quotearg.c":642, 0x10042e4c]
> 
> This makes it appear that a file name of ((char *) 1) is being printed
> out, which suggests that the locations are bollixed up somehow inside Bison.
> 
> >    7 grammar_rule_end(loc = (...)) 
> > ["/opt/build/bison-1.875d/src/reader.c":265, 0x100266b8]
> 
> It's too bad we can't see what that location was.  Can you please do
> the equivalent of the following GDB session to see where (if anywhere)
> in this calling chain that it got messed up?  This uses the same test
> file "a" that you were using.  Thanks.
> 
> (gdb) b grammar_rule_end
> Breakpoint 21 at 0x805e7cc: file reader.c, line 263.
> (gdb) r a
> Starting program: /home/eggert/src/bison/bison-1.875d-irix/src/bison a
> 
> Breakpoint 21, grammar_rule_end (loc=
>         {start = {file = 0x8083ac8 "a", line = 4, column = 6}, end = {file = 
> 0x8083ac8 "a", line = 4, column = 16}}) at reader.c:263
> (gdb) p loc
> $34 = {start = {file = 0x8083ac8 "a", line = 4, column = 6}, end = {
>     file = 0x8083ac8 "a", line = 4, column = 16}}
> ...

$ dbx ../src/bison
dbx> stop grammar_rule_end
dbx> run a
Process 21275392 (bison) started
[3] Process 21275392 (bison) stopped at [grammar_rule_end:263 ,0x1002663c]
 263  grammar_symbol_append (NULL, grammar_end->location);
dbx> print loc
struct {
    start = struct {
        file = 0x10061980 = "a"
        line = 4
        column = 6
    }
    end = struct {
        file = 0x1
        line = 0
        column = 0
    }
} 

dbx> stop grammar_current_rule_check
dbx> cont
[4] Process 21275392 (bison) stopped at [grammar_current_rule_check:225 
,0x100264b8]
 225  symbol *lhs = current_rule->sym;
dbx> print current_rule[0]
struct symbol_list {
    next = 0x1006ce08
    sym = 0x1006cd40
    location = struct {
        start = struct {
            file = 0x10061980 = "a"
            line = 4
            column = 6
        }
        end = struct {
            file = 0x1
            line = 0
            column = 0
        }
    }
    action = (nil)
    action_location = struct {
        start = struct {
            file = 0x10061980 = "a"
            line = 4
            column = 10
        }
        end = struct {
            file = 0x4
            line = 0
            column = 0
        }
    }
    ruleprec = (nil)
    dprec = 0
    merger = 0
} 

dbx> stop warn_at
dbx> cont
[5] Process 21275392 (bison) stopped at [warn_at:49 ,0x1000942c]
  49  location_print (stderr, loc);
dbx> print loc
struct {
    start = struct {
        file = 0x10061980 = "a"
        line = 4
        column = 6
    }
    end = struct {
        file = 0x1
        line = 0
        column = 0
    }
} 

dbx> stop location_print
dbx> cont
[6] Process 21275392 (bison) stopped at [location_print:34 ,0x10010a10]
  34  fprintf (out, "%s:%d.%d",
(dbx) print loc
struct {
    start = struct {
        file = 0x10061980 = "a"
        line = 4
        column = 6
    }
    end = struct {
        file = 0x1
        line = 0
        column = 0
    }
} 

Seems broken from the start as loc isn't correct. I get the following
warnings when building src/parse-gram.c, though none look detrimental.
  $ cc -DHAVE_CONFIG_H -DPKGDATADIR=\"/opt/TWWfsw/bison18/share/bison\"
  -DLOCALEDIR=\"/opt/TWWfsw/bison18/share/locale\" -I. -I. -I..
  -I../lib -I../lib -I/opt/TWWfsw/libiconv18/include
  -I/opt/TWWfsw/gettext011/include   -g -c parse-gram.c
cc-1035 cc: WARNING File = /usr/include/stdint.h, Line = 5
  #error directive:  This header file is to be used only for c99 mode
          compilations

  #error This header file is to be used only for c99 mode compilations
   ^

cc-1185 cc: WARNING File = location.h, Line = 43
  An enumerated type is mixed with another type.

    return (a.column == b.column
           ^

cc-1185 cc: WARNING File = ../lib/bitset.h, Line = 165
  An enumerated type is mixed with another type.

      return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1;
             ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 187
  An enumerated type is mixed with another type.

      { debug_flag = true; }
                   ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 189
  An enumerated type is mixed with another type.

      { defines_flag = true; }
                     ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 190
  An enumerated type is mixed with another type.

      { error_verbose = true; }
                      ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 196
  An enumerated type is mixed with another type.

      nondeterministic_parser = true;
                              ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 197
  An enumerated type is mixed with another type.

      glr_parser = true;
                 ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 204
  An enumerated type is mixed with another type.

      { locations_flag = true; }
                       ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 206
  An enumerated type is mixed with another type.

      { no_lines_flag = true; }
                      ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 207
  An enumerated type is mixed with another type.

      { nondeterministic_parser = true; }
                                ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 210
  An enumerated type is mixed with another type.

      { pure_parser = true; }
                    ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 212
  An enumerated type is mixed with another type.

      { token_table_flag = true; }
                         ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 214
  An enumerated type is mixed with another type.

      { yacc_flag = true; }
                  ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 227
  An enumerated type is mixed with another type.

        typed = true;
              ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 247
  An enumerated type is mixed with another type.

        default_prec = true;
                     ^

cc-1185 cc: WARNING File = parse-gram.y, Line = 251
  An enumerated type is mixed with another type.

        default_prec = false;
                     ^

Maybe this is a compiler bug. I ran bison through the ladebug debugger
on Tru64 UNIX and loc was correct after breaking into
grammar_rule_end().

Ok, I found the problem. In src/parse-gram.c, you have:
  static YYLTYPE
  lloc_default (YYLTYPE const *rhs, int n) 
  {  
    int i;
    YYLTYPE loc;
    loc.start = loc.end = rhs[n].end;

At the moment "loc.start = loc.end = rhs[n].end" is executed:
  dbx> step
  Process 21285623 (bison) stopped at [lloc_default:446 ,0x10022260]
   446  loc.start = loc.end = rhs[n].end;
  (dbx) print loc
  struct {
      start = struct {
          file = (nil)
          line = 0
          column = 0
      }
      end = struct {
          file = (nil)
          line = 0
          column = 0
      }
  } 
  (dbx) step
  Process 21285623 (bison) stopped at [lloc_default:451 ,0x100222c8]
   451  for (i = 1; i <= n; i++)
  (dbx) print loc
  struct {
      start = struct {
          file = 0x10061980 = "a"
          line = 1
          column = 0
      }
      end = struct {
          file = (nil)
          line = 0
          column = 0
      }
  } 

Oh, I found the problem. I stepped through parse_gram.c. The patch
below fixes it for me. Now I'm left with the following failures:
   To: <address@hidden>
   Subject: [GNU Bison 1.875d] testsuite: 43 84 86 87 88 89 failed

Thanks _a lot_ for your help! I created a small test case and will
report the bug to SGI.

-- 
albert chin (address@hidden)

-- snip snip
2004-05-26  Albert Chin-A-Young  <address@hidden>

        src/parse-gram.y: Work around bug in SGI C compiler assigning
        to a struct. Split up:
          loc.start = loc.end = rhs[n].end;
        to:
          loc.start = rhs[n].end;
          loc.end = rhs[n].end;

--- src/parse-gram.y.orig       Wed May 26 17:21:15 2004
+++ src/parse-gram.y    Wed May 26 17:21:29 2004
@@ -443,7 +443,8 @@
 {
   int i;
   YYLTYPE loc;
-  loc.start = loc.end = rhs[n].end;
+  loc.start = rhs[n].end;
+  loc.end = rhs[n].end;
 
   /* Ignore empty nonterminals the start of the the right-hand side.
      Do not bother to ignore them at the end of the right-hand side,




reply via email to

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