bison-patches
[Top][All Lists]
Advanced

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

Re: 99 100 Exploding the Stack Size exit status


From: Paul Eggert
Subject: Re: 99 100 Exploding the Stack Size exit status
Date: Sun, 17 Jul 2005 23:16:33 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

address@hidden writes:

> 99 100 Exploding the Stack Size exit status
>
> These tests:
>   99: torture.at:441     Exploding the Stack Size with Alloca
>  100: torture.at:466     Exploding the Stack Size with Malloc
>
> Test 99 and 100 return 1 instead of 2 when simulating malloc failure.
> Test 96 and  97 return 2 and there never happen segfaults in yacc.c.
>
> doing this in data/yacc.c:
>
>       {
>       short int *yyss1 = yyss;
>       union yyalloc *yyptr =  (union yyalloc *) 0; /* YYSTACK_ALLOC
> (YYSTACK_BYTES (yystacksize)); */
> //    if (! yyptr)
>         goto yyoverflowlab;
>       YYSTACK_RELOCATE (yyss);
>       YYSTACK_RELOCATE (yyvs);
>
> Should the exit status not be 2 in test 99 and 100?

Yes, it should.

> Solution is to remove the exit(1); in tests/torture.at:407

Thanks.  I found some other instances of the problem as well.
I installed the patch enclosed below.

> [fully tested the yacc.c  and it never segfaults at malloc() failures]
>
> [these testcases are not there: multiple glr parsers in one program,
> multiple yacc parsers in one program, multiple lexers+glr parsers
> in one program, multiple lexers+yacc parsers in one program]

Yes, these would be nice improvements to the test suite.

2005-07-17  Paul Eggert  <address@hidden>

        * tests/conflicts.at (%nonassoc and eof):  Don't exit with status
        1 on syntax error; just let yyparse do its thing.
        * tests/glr-regression.at (Badly Collapsed GLR States): Likewise.
        * tests/torture.at (AT_DATA_STACK_TORTURE): Likewise.
        (Exploding the Stack Size with Alloca):
        (Exploding the Stack Size with Malloc):
        Expect exit status 2, not 1, since the parser is supposed to blow
        its stack.  Problem reported by address@hidden

Index: tests/conflicts.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/conflicts.at,v
retrieving revision 1.29
diff -p -u -r1.29 conflicts.at
--- tests/conflicts.at  14 May 2005 06:49:48 -0000      1.29
+++ tests/conflicts.at  18 Jul 2005 06:06:20 -0000
@@ -62,7 +62,6 @@ static void
 yyerror (const char *msg)
 {
   fprintf (stderr, "%s\n", msg);
-  exit (1);
 }
 
 /* The current argument. */
Index: tests/glr-regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/glr-regression.at,v
retrieving revision 1.9
diff -p -u -r1.9 glr-regression.at
--- tests/glr-regression.at     14 Jul 2005 23:57:28 -0000      1.9
+++ tests/glr-regression.at     18 Jul 2005 06:06:20 -0000
@@ -74,7 +74,6 @@ int
 yyerror (char const *msg)
 {
   fprintf (stderr, "%s\n", msg);
-  exit (4);
 }
 
 
Index: tests/torture.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/torture.at,v
retrieving revision 1.26
diff -p -u -r1.26 torture.at
--- tests/torture.at    14 May 2005 06:49:48 -0000      1.26
+++ tests/torture.at    18 Jul 2005 06:06:21 -0000
@@ -404,7 +404,6 @@ static void
 yyerror (const char *msg)
 {
   fprintf (stderr, "%s\n", msg);
-  exit (1);
 }
 
 /* There are YYLVAL_MAX of WAIT_FOR_EOFs. */
@@ -452,7 +451,7 @@ AT_PARSER_CHECK([./input 20], 0, [], [ig
 AT_PARSER_CHECK([./input 900], 0, [], [ignore])
 # Fails: beyond the limit of 10,000 (which we don't reach anyway since we
 # multiply by two starting at 200 => 5120 is the last possible).
-AT_PARSER_CHECK([./input 10000], 1, [], [ignore])
+AT_PARSER_CHECK([./input 10000], 2, [], [ignore])
 
 AT_CLEANUP
 
@@ -473,6 +472,6 @@ AT_PARSER_CHECK([./input 20], 0, [], [ig
 AT_PARSER_CHECK([./input 900], 0, [], [ignore])
 # Fails: beyond the limit of 10,000 (which we don't reach anyway since we
 # multiply by two starting at 200 => 5120 is the possible).
-AT_PARSER_CHECK([./input 10000], 1, [], [ignore])
+AT_PARSER_CHECK([./input 10000], 2, [], [ignore])
 
 AT_CLEANUP




reply via email to

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