help-bison
[Top][All Lists]
Advanced

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

AW: AW: Segmentation Fault in yyparse() method


From: Jonas Stahl
Subject: AW: AW: Segmentation Fault in yyparse() method
Date: Thu, 15 Nov 2007 20:49:48 +0100

> Try running the application under valgrind or some other memory debugger.
> If possible also try slightly different releases of gcc (4.1.1 or 4.2);
> there's an outside chance that it's a bug in gcc.

Thanks. I think this isolated the fault a bit more.
I tried debugging under valgrind. The result was this:

==6040== Warning: client switching stacks?  SP change: 0xBED3A730 -->
0xBDABEDF0
==6040==          to suppress, use: --max-stackframe=19380544 or greater
==6040== Invalid write of size 4
==6040==    at 0x804A12C: yyparse (fullParser.tab.c:32956)
==6040==  Address 0xBED3A72C is on thread 1's stack 
==6040== 
==6040== Invalid write of size 4
==6040==    at 0x804A131: yyparse (fullParser.tab.c:32964)
==6040==  Address 0xBED331CC is on thread 1's stack 
==6040== Stack overflow in thread 1: can't grow stack to 0xBED331CC 
==6040== 
==6040== Process terminating with default action of signal 11 (SIGSEGV)
==6040==  Access not within mapped region at address 0xBED331CC
==6040==    at 0x804A131: yyparse (fullParser.tab.c:32964)
==6040==
==6040== Process terminating with default action of signal 11 (SIGSEGV)
==6040==  Access not within mapped region at address 0xBDABEDEC
==6040==    at 0x401D200: _vgnU_freeres (vg_preloaded.c:56)


The adequate Code Lines: 

32939 #ifdef YYPARSE_PARAM
32940 # if defined (__STDC__) || defined (__cplusplus)
32941 int yyparse (void *YYPARSE_PARAM)
32942 # else
32943 int yyparse (YYPARSE_PARAM)
32944   void *YYPARSE_PARAM;
32945 # endif
32946 #else /* ! YYPARSE_PARAM */
32947 #if defined (__STDC__) || defined (__cplusplus)
32948 int
32949 yyparse (void)
32950 #else
32951 int
32952 yyparse ()
32953     ;
32954 #endif
32955 #endif
32956 {
32957   
32958   int yystate;
32959  int yyn;
32960   int yyresult;
32961   /* Number of tokens to shift before error messages enabled.  */
32962   int yyerrstatus;
32963   /* Look-ahead token as an internal (translated) token number.  */
32964  int yytoken = 0;

What I get of this, is that the yyparse() method can't get stacked and it
crashes at the first statement, where a new value has to get stacked. But
GDB runs over these lines and throws segmentation fault, when reaching the
YYLEX method call, because when stacking another method it finally does not
know what to do. I think GDB shows the wrong point, because printf's before
the YYLEX call aren't done.

But the big question still is, why it doesn't want to stack :-D

I already tried the other ubuntu precompiled gcc versions. On version 3.4.6
it runs, but I had to fix some minor bugs. I wanted to test 4.x.x versions
but building took about an hour...is it always so slow? Tomorrow I'll try
again, but now I'm tired and need to rest :D





reply via email to

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