help-bison
[Top][All Lists]
Advanced

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

Re: std::string as YYSTYPE segfaults


From: Hans Aberg
Subject: Re: std::string as YYSTYPE segfaults
Date: Thu, 28 Feb 2002 21:06:18 +0100

At 16:20 +0100 2002/02/28, Magnus Ekhall wrote:
[Please cc replies to Help Bison.]
>It works for a number of tokens, but then I get a segmentation fault:

You do not give enough information to tell: Segmentation fault just means
"memory error", which could mean that you have run out of parameter stack,
allocation of dynamic memory or is trying to access an illegal memory
address.

>in basic_string<char, string_char_traits<char>,
>__default_alloc_template<false, 0> >::Rep::release (this=0xfffffff0)

If you use the dynamic stack of the Bison generated parser, that may cause
problems with C++ con-/de-structors, as it reallocates only by using raw
memory (memcpy) copying, thus ignoring any C++ copy constructors.

So if your project is using a lot of stack, try to increase the initial
static stack so that you never use the dynamic one.

The gurus on this list say a proper C++ version will come forth in about
one month; so use then, when that one arrives. (Or, do as I did, write your
own C++ parser. :-) )

  Hans Aberg





reply via email to

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