From: Joel E. Denny Date: Wed, 10 Jan 2007 00:50:55 +0000 (+0000) Subject: Ignore YYSTACK_USE_ALLOCA for push parsers since the stacks can't be X-Git-Tag: v2.3b~185 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/78143faa1652400c22826281258a196084ed0312?ds=inline Ignore YYSTACK_USE_ALLOCA for push parsers since the stacks can't be locals. Reported by Juan Manuel Guerrero at . * data/push.c: Enclose the #ifdef YYSTACK_USE_ALLOCA in b4_push_if. Fix some indentation also. * tests/torture.at (Exploding the Stack Size with Alloca): Add comment explaining this issue. --- diff --git a/ChangeLog b/ChangeLog index 4c306fcc..af1b08bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-01-09 Joel E. Denny + + Ignore YYSTACK_USE_ALLOCA for push parsers since the stacks can't be + locals. Reported by Juan Manuel Guerrero at + . + * data/push.c: Enclose the #ifdef YYSTACK_USE_ALLOCA in b4_push_if. + Fix some indentation also. + * tests/torture.at (Exploding the Stack Size with Alloca): Add comment + explaining this issue. + 2007-01-09 Paolo Bonzini and Joel E. Denny diff --git a/data/push.c b/data/push.c index 70cad70d..739ac2a7 100644 --- a/data/push.c +++ b/data/push.c @@ -332,7 +332,8 @@ typedef short int yytype_int16; #if ! defined yyoverflow || YYERROR_VERBOSE -/* The parser invokes alloca or malloc; define the necessary symbols. */ +]b4_push_if([], +[[/* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA @@ -357,7 +358,8 @@ typedef short int yytype_int16; # endif # endif -# ifdef YYSTACK_ALLOC +]])dnl +[# ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM @@ -1089,13 +1091,13 @@ b4_push_if( ]b4_locations_if([[ YYLTYPE yylloc; ]])])[ if (yyps == 0) - yyps_local = yypstate_new (); - else - yyps_local = yyps; - do { - yychar = YYLEX; - yystatus = - yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])[); + yyps_local = yypstate_new (); + else + yyps_local = yyps; + do { + yychar = YYLEX; + yystatus = + yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])[); } while (yystatus == YYPUSH_MORE); if (yyps == 0) yypstate_delete (yyps_local); @@ -1149,8 +1151,8 @@ b4_c_function_def([yyparse], [int], [[void *YYPARSE_PARAM], [YYPARSE_PARAM]]) b4_c_function_def([yyparse], [int], b4_parse_param) #endif])[ { - ]b4_pure_if([b4_declare_scanner_communication_variables]) - b4_push_if([b4_pure_if([], [[ int yypushed_char = yychar; +]b4_pure_if([b4_declare_scanner_communication_variables]) +b4_push_if([b4_pure_if([], [[ int yypushed_char = yychar; YYSTYPE yypushed_val = yylval; ]b4_locations_if([[YYLTYPE yypushed_loc = yylloc; ]])])], diff --git a/tests/torture.at b/tests/torture.at index fabab2df..6e1a1a48 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -490,6 +490,9 @@ AT_PARSER_CHECK([./input 900], 0, [], [ignore]) # multiply by two starting at 200 => 5120 is the last possible). AT_PARSER_CHECK([./input 10000], 2, [], [ignore]) +# The push parser can't use alloca since the stacks can't be locals. This test +# just helps guarantee we don't let the YYSTACK_USE_ALLOCA feature affect +# push parsers. AT_DATA_STACK_TORTURE([AT_USE_ALLOCA], [[%push-pull-parser ]])