mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 08:13:02 +00:00
(glr-regr2a.y): Try to dump core
immediately if a data overrun has occurred; this may help us track down what may be a spurious failure on MacOS.
This commit is contained in:
@@ -127,6 +127,7 @@ AT_DATA_GRAMMAR([glr-regr2a.y],
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
int yylex (void);
|
int yylex (void);
|
||||||
void yyerror (char const *);
|
void yyerror (char const *);
|
||||||
@@ -155,11 +156,10 @@ var_list:
|
|||||||
{ $$ = $1; }
|
{ $$ = $1; }
|
||||||
| var ',' var_list
|
| var ',' var_list
|
||||||
{
|
{
|
||||||
char buffer[50];
|
$$ = malloc (strlen ($1) + 1 + strlen ($3) + 1);
|
||||||
strcpy (buffer, $1);
|
strcpy ($$, $1);
|
||||||
strcat (buffer, ",");
|
strcat ($$, ",");
|
||||||
strcat (buffer, $3);
|
strcat ($$, $3);
|
||||||
$$ = strdup (buffer);
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -182,8 +182,12 @@ yylex (void)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fscanf (yyin, "%s", buf);
|
if (fscanf (yyin, "%49s", buf) != 1)
|
||||||
yylval = strdup (buf);
|
abort ();
|
||||||
|
if (sizeof buf - 1 <= strlen (buf))
|
||||||
|
abort ();
|
||||||
|
yylval = malloc (strlen (buf) + 1);
|
||||||
|
strcpy (yylval, buf);
|
||||||
return 'V';
|
return 'V';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user