golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
121.78k stars 17.42k forks source link

cmd/yacc: remove hardcoded limits TEMPSIZE and NSTATES #16144

Open snadrus opened 8 years ago

snadrus commented 8 years ago

1.5 & 1.7rc2 on amd64 mac

  1. What did you do?

go get github.com/snadrus/sqlin cd $GOPATH/github.com/snadrus/sqlin/src/parse go tool yacc -o parser.go -p parse parser.y

  1. What did you expect to see? sql2003 spec becoming parser.go, or an actionable error.
  2. What did you see instead? In Go 1.7rc2: panic: runtime error: index out of range

goroutine 1 [running]: panic(0x1124a0, 0xc42000e150) /usr/local/go/src/runtime/panic.go:500 +0x1a1 main.aryfil(0xc4200a6000, 0x7d0, 0x7d0, 0x883, 0x0) /usr/local/go/src/cmd/yacc/yacc.go:1522 +0x41 main.stagen() /usr/local/go/src/cmd/yacc/yacc.go:1781 +0x3f3 main.main() /usr/local/go/src/cmd/yacc/yacc.go:359 +0x5d

ianlancetaylor commented 8 years ago

There are hard-coded limits in yacc that remain from when it was a C program. This should be fixed, but not for 1.7 (and see also #11229). For 1.7 I'll send a CL for an error rather than a panic.

gopherbot commented 8 years ago

CL https://golang.org/cl/24321 mentions this issue.