diff --git a/src/cmd/yacc/yacc.go b/src/cmd/yacc/yacc.go index 6f67ab65669..8a5df052ecf 100644 --- a/src/cmd/yacc/yacc.go +++ b/src/cmd/yacc/yacc.go @@ -683,6 +683,10 @@ outer: levprd[nprod] = 0 } + if TEMPSIZE < ntokens+nnonter+1 { + errorf("too many tokens (%d) or non-terminals (%d)", ntokens, nnonter) + } + // // end of all rules // dump out the prefix code