bug-bison
[Top][All Lists]
Advanced

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

Re: huge input files, stack size exceeded??


From: Joerg Hoffmann
Subject: Re: huge input files, stack size exceeded??
Date: Tue, 07 Oct 2003 10:08:15 +0200
User-agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.0.1) Gecko/20020920 Netscape/7.0


Dear Mr. Eggert,

cool, that works! Thanks very much!

Just one more question: when I insert the lines you suggested into the .y source code, i.e.

#ifndef YYMAXDEPTH
#define YYMAXDEPTH 100000
#endif

#ifndef YYSTACK_ALLOC
#define YYSTACK_ALLOC malloc
#endif

#ifndef YYSTACK_FREE
#define YYSTACK_FREE free
#endif


in the resulting .tab.c code I get those lines, plus the sequence


# if YYSTACK_USE_ALLOCA
#  define YYSTACK_ALLOC alloca
# else
#  ifndef YYSTACK_USE_ALLOCA
#   if defined (alloca) || defined (_ALLOCA_H)
#    define YYSTACK_ALLOC alloca
#   else
#    ifdef __GNUC__
#     define YYSTACK_ALLOC __builtin_alloca
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's `empty if-body' warning. */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
#  if defined (__STDC__) || defined (__cplusplus)
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   define YYSIZE_T size_t
#  endif
#  define YYSTACK_ALLOC malloc
#  define YYSTACK_FREE free
# endif
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */


When I changed this by hand, the bug was fixed. But of course I'd rather not have to go into the .tab.c files every time I make the software.

Is there a way to make Bison NOT generate this definition block?

Many thanks again,
Joerg Hoffmann






Paul Eggert wrote:
Joerg Hoffmann <address@hidden> writes:

  
#0  0x08064744 in ops_pddlparse () at scan-ops_pddl.tab.c:1070
1070            YYSTACK_RELOCATE (yyss);
    

Most likely your hosts has an inadequate check for stack overflow,
i.e. when you call alloca with a large number, it will return a
bad pointer.

If my guess is right, try doing this:

#define YYSTACK_ALLOC malloc
#define YYSTACK_FREE free

This will cause the parser to use 'malloc' and 'free' rather than the
inadequate 'alloca' implementation.

  


reply via email to

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