bug-bison
[Top][All Lists]
Advanced

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

Re: bison bug.


From: Hans Aberg
Subject: Re: bison bug.
Date: Sat, 29 Dec 2001 14:48:11 +0100

At 17:14 -0800 2001/12/28, James Harris wrote:
>As I suspected, the mixing of shorts and ints seems to be the root of the
>problem.

I get an unmapped memory exception at the line below at the arrow.

File LR0.c:
static void
new_itemsets (void)
{
...
  for (i = 0; i < nitemset; ++i)
    {
      int symbol = ritem[itemset[i]];
      if (symbol > 0)
        {
          if (!kernel_size[symbol])
            {
              shift_symbol[nshifts] = symbol;
              nshifts++;
            }

-->       kernel_base[symbol][kernel_size[symbol]] = itemset[i] + 1;
          kernel_size[symbol]++;
        }
    }
}

>  As an example in output_gram() yyrhs_size is declared as size_t,
>then is passed as the last argrument of output_short_table wich is
>expecting a short. I think the root of problem is that the test case
>nitems is larger then SHRT_MAX.

You could try replacing the shorts of this line, in the structure "core" in
state.h, and their uses, to see if the bug goes away.

In C, there is no guarantee that ints are longer than shorts, but one is
guaranteed that longs contain values +/-(2^31-1), so what one can do is the
following:
#if INT_MAX >= 2147483647
typedef int my_int;
#else
typedef long my_int;
#endif

  Hans Aberg





reply via email to

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