public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: bison 1.33 problem with mainline c-parse.in: yyfree_stacks
@ 2002-04-26  9:53 John David Anglin
  2002-04-26 10:22 ` Joseph S. Myers
  0 siblings, 1 reply; 6+ messages in thread
From: John David Anglin @ 2002-04-26  9:53 UTC (permalink / raw)
  To: gcc; +Cc: mec

> gcc -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -DHAVE_CONFIG_H    -I. -I. -I/berman/fsf/_today_/source/gcc/HEAD/gcc/gcc -I/berman/fsf/_today_/source/gcc/HEAD/gcc/gcc/. -I/berman/fsf/_today_/source/gcc/HEAD/gcc/gcc/config -I/berman/fsf/_today_/source/gcc/HEAD/gcc/gcc/../include \
>        -c /berman/fsf/_today_/source/gcc/HEAD/gcc/gcc/c-parse.c -o c-parse.o
> /berman/migchain/install/native/bison-1.33/share/bison/bison.simple: In function `yyparse':
> /berman/migchain/install/native/bison-1.33/share/bison/bison.simple:521: `yyfree_stacks' undeclared (first use in this function)

It appears that bison defines this in intl/plural.c.  I suspect that the
above error is a result of building bison with NLS disabled.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: bison 1.33 problem with mainline c-parse.in: yyfree_stacks
@ 2002-04-26 11:50 Michael Elizabeth Chastain
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Elizabeth Chastain @ 2002-04-26 11:50 UTC (permalink / raw)
  To: dave, jsm28; +Cc: gcc

The red herring ...

  I did build my bison 1.33 with --disable-nls.  But I rebuilt bison 1.33
  and the gcc build still fails.

  I'm not an "intl" expert, but it looks like intl/plural.y is part of
  the intl library that goes with the bison executable and is not part of
  bison.hairy or bison.simple.  It just happens to be a bison program so it
  gets processed with bison.  In bison-1.33.tar.gz, intl/plural.c was built
  with bison 1.28.  That is why we see the simple "yyfree_stacks" in it.

The bison story ...

  "yyfree_stacks" in bison.simple disappeared between bison 1.30 and
  bison 1.31.  In the CVS version of bison, Paul Eggert removed it in
  1.53.2.8 of src/bison.simple (this is on a branch and the file has
  been moved to data/bison.simple since then, what fun).  It looks
  like part of a big memory-management cleanup.  cvs log entry appended.

  Here is the logic flow:

    yyss, yyvs, yyls are initialized to point to auto arrays.
    yyoverflow can change these pointers to point to heap arrays.
    yyfree_stacks tracks whether yyss, yyvs, yyls point to auto or heap.
    if yyfree_stacks is true, you may call realloc() to grow the stacks.
    if yyfree_stacks is true, yyparse() must call free() before returning.

  The old parser does:

    yyacceptlab:
      if (yyfree_stacks)
	{
	  free (yyss);
	  free (yyvs);
    #if YYLSP_NEEDED
	  free (yyls);
    #endif
	}
      return 0;

  But the new parser does:

    yyreturn:
    #ifndef yyoverflow
      if (yyss != yyssa)
	YYSTACK_FREE (yyss);
    #endif
      return yyresult;

  It's hard to write a yyoverflow that works with both versions
  of bison.simple.  yyoverflow can have its own local version of
  "yyfree_stacks" and ignore the one that belongs to yyparse.  But this
  produces a memory leak with old-style bison.simple that needs to see
  "yyfree_stacks" set to 1.

What to do ...

  gcc/configure already checks the version of bison.

  Perhaps write yyoverflow for the new parser only (bison 1.31 or later)
  and then require bison 1.31 in gcc/configure?

  gcc/configure could also pass the bison version in a configuration
  variable to c-parse.in, so that c-parse.in could have code for
  both cases.

  Right now, the code works only with old bison (bison 1.30 or earlier)
  and there is no check.

Oy!

Michael C

===

# cvs log src/bison.simple
revision 1.53.2.8
date: 2001/11/30 02:47:56;  author: eggert;  state: Exp;  lines: +93 -67
(YYSTACK_REALLOC): Remove.
(YYSTACK_ALLOC): Resurrect this macro, with its old meaning.
(YYSTACK_FREE, YYSTACK_GAP_MAX, YYSTACK_BYTES, YYSTACK_RELOCATE):
New macros.
(union yyalloc): New type.
(__yy_memcpy): Last arg is size_t, not unsigned int, to remove
an arbitrary restriction on hosts where size_t is wider than int.

(yyparse): Don't dump core if alloca or malloc fails; instead, report
a parser stack overflow.  Allocate just one block of memory for all
three stacks, instead of allocating three blocks; this typically is
faster and reduces fragmentation.

Do not limit the number of items in the stack to a value that fits
in 'int', as this is an arbitrary limit on hosts with 64-bit
size_t and 32-bit int.

^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <no.id>]
* bison 1.33 problem with mainline c-parse.in: yyfree_stacks
@ 2002-04-26  8:59 Michael Elizabeth Chastain
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Elizabeth Chastain @ 2002-04-26  8:59 UTC (permalink / raw)
  To: rth; +Cc: gcc

I'm building gcc trunk with bison 1.33.  I'm getting an undeclared symbol
error for "yyfree_stacks".  It looks like yyfree_stacks does not exist in
recent versions of bison.simple.

This is native i686-pc-linux-gnu configuration.  This worked for me
on 2002-04-21.

Michael C

===

gcc -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -DHAVE_CONFIG_H    -I. -I. -I/berman/fsf/_today_/source/gcc/HEAD/gcc/gcc -I/berman/fsf/_today_/source/gcc/HEAD/gcc/gcc/. -I/berman/fsf/_today_/source/gcc/HEAD/gcc/gcc/config -I/berman/fsf/_today_/source/gcc/HEAD/gcc/gcc/../include \
       -c /berman/fsf/_today_/source/gcc/HEAD/gcc/gcc/c-parse.c -o c-parse.o
/berman/migchain/install/native/bison-1.33/share/bison/bison.simple: In function `yyparse':
/berman/migchain/install/native/bison-1.33/share/bison/bison.simple:521: `yyfree_stacks' undeclared (first use in this function)
/berman/migchain/install/native/bison-1.33/share/bison/bison.simple:521: (Each undeclared identifier is reported only once
/berman/migchain/install/native/bison-1.33/share/bison/bison.simple:521: for each function it appears in.)
/berman/migchain/install/native/bison-1.33/share/bison/bison.simple:945: warning: label `yyoverflowlab' defined but not used
make[1]: *** [c-parse.o] Error 1
make[1]: Leaving directory `/berman/fsf/_today_/berman/native/build/gcc/HEAD/gcc'
make: *** [all-gcc] Error 2

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-04-26 18:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-26  9:53 bison 1.33 problem with mainline c-parse.in: yyfree_stacks John David Anglin
2002-04-26 10:22 ` Joseph S. Myers
2002-04-26 10:31   ` John David Anglin
  -- strict thread matches above, loose matches on Subject: below --
2002-04-26 11:50 Michael Elizabeth Chastain
     [not found] <no.id>
2002-04-26 10:43 ` John David Anglin
2002-04-26  8:59 Michael Elizabeth Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).