mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
glr.c: initialize vector of bools
The CI, with CC='gcc-7 -fsanitize=undefined,address
-fno-omit-frame-pointer', reports:
calc.cc:1652:50: runtime error: load of value 190, which is not a valid value for type 'bool'
../../tests/calc.at:867: cat stderr
--- expout 2019-09-05 20:30:37.887257545 +0000
+++ /home/travis/build/bison-3.4.1.72-79a1-dirty/_build/tests/testsuite.dir/at-groups/438/stdout 2019-09-05 20:30:37.887257545 +0000
@@ -1 +1,2 @@
syntax error
+calc.cc:1652:50: runtime error: load of value 190, which is not a valid value for type 'bool'
438. calc.at:867: 438. Calculator glr.cc (calc.at:867): FAILED (calc.at:867)
The problem is that yylookaheadNeeds is not initialized in
yyinitStateSet, and when it is copied, the value is not 0 or 1.
* data/skeletons/glr.c (yylookaheadNeeds): Initialize yylookaheadNeeds.
This commit is contained in:
@@ -1094,17 +1094,20 @@ yyinitStateSet (yyGLRStateSet* yyset)
|
||||
{
|
||||
yyset->yysize = 1;
|
||||
yyset->yycapacity = 16;
|
||||
yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]);
|
||||
yyset->yystates
|
||||
= (yyGLRState**) YYMALLOC (yyset->yycapacity * sizeof yyset->yystates[0]);
|
||||
if (! yyset->yystates)
|
||||
return yyfalse;
|
||||
yyset->yystates[0] = YY_NULLPTR;
|
||||
yyset->yylookaheadNeeds =
|
||||
(yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]);
|
||||
yyset->yylookaheadNeeds
|
||||
= (yybool*) YYMALLOC (yyset->yycapacity * sizeof yyset->yylookaheadNeeds[0]);
|
||||
if (! yyset->yylookaheadNeeds)
|
||||
{
|
||||
YYFREE (yyset->yystates);
|
||||
return yyfalse;
|
||||
}
|
||||
memset (yyset->yylookaheadNeeds,
|
||||
0, yyset->yycapacity * sizeof yyset->yylookaheadNeeds[0]);
|
||||
return yytrue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user