Prof A Olowofoyeku (The African Chief) wrote:
On 19 Feb 2006 at 22:41, Waldek Hebisch wrote:
Prof A Olowofoyeku (The African Chief) wrote:
This is the result:
(gdb) run -famtmpfile=foo -fautomake -fextended-syntax -fignore- function-results -fno-io-checking -fno-stack-checking -fimplicit-result -fdelphi-method- shadowin g cwindows.pas Starting program: f:/mingw/libexec/gcc/mingw32/3.4.5/gpc1.exe - famtmpfile=foo -f automake -fextended-syntax -fignore-function-results -fno-io-checking
- fno-stack -checking -fimplicit-result -fdelphi-method-shadowing
cwindows.pas
Program received signal SIGSEGV, Segmentation fault. yyprocessOneStack (yystack=0x174fde0, yyk=0, yyposn=1999, yylvalp=0x80c010, yyllocp=0x80c014) at parse.c:8436 8436 parse.c: No such file or directory. in parse.c (gdb) bt #0 yyprocessOneStack (yystack=0x174fde0, yyk=0, yyposn=1999, yylvalp=0x80c010, yyllocp=0x80c014) at parse.c:8436 #1 0x00410f23 in main_yyparse () at parse.c:9345 #2 0x005147be in toplev_main (argc=10, argv=0x122490) at ../../gcc/toplev.c:1822 #3 0x0054f06a in main (argc=10, argv=0x122490) at ../../gcc/main.c:35 (gdb)
Could you at this point print a few relevanat variables:
print yystack->yyspaceLeft
$1 = 4294966881
print (yystack->yynextFree - yystack->yyitems)
$2 = 10415
I hope this makes sense to you!
Yes, it is parser stack overflow. The yyspaceLeft counts free stack slots. yyspaceLeft is unsigned in C, so it is really 4294966881 - 4294967296 = -415 (so far beyond stack end). The `(yystack->yynextFree - yystack->yyitems)' gives actual stack usage. Current max is 10000, so this agrees with the first number. Also, it confirms that parser stack is correctly enlarged up to max size and overflows only after reaching maximal size.
AFAICS the problem with undetected stack overflow is present in earlier versions of GPC (probably in all versions with GLR parser). Parser in gpc-20060216 uses more space, so the problem showed up. Patches that I posted in another mail should fix the problem: one hunk adds missing check and another enlarges parser stack, so that GPC should be able to handle bigger input.