golang/go

go/types: compiling hangs

dvyukov opened this issue · 6 comments

The following program takes 1+ hours to compile, aborted after that:

package a
var g = 1e81391777742999

Package should either analyze it in a reasonable amount of time (seconds) or give an error if it cannot chew it. Compiling a single line of code for hours does not make sense.

on commit af81789

I propose that gc/types employ exactly the same logic as gc compiler:
https://go-review.googlesource.com/#/c/11673/1/src/cmd/compile/internal/gc/mparith3.go

Both go tool vet and the command vet hang in this case.

rsc commented

This one is important. @griesemer, can you take a look? Thanks.

Started.

The largest decimal exponent that needs to be accepted is 646456992 (approx. 2**MaxInt32). See also issue #11326.

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