compiler: avoid silent truncation for string(1 << 32)

In the conversion of a constant integer to a string type, the value of
the constant integer was being silently truncated from unsigned long
to unsigned int, producing the wrong string value.  Add an explicit
overflow check to avoid this problem.

For golang/go#42790

Change-Id: I3407410bb02c24edd114e5f78a1f60ab66378656
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/272611
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
1 file changed