golang/go

gccgo: string(1<<100) should evaluate to "\uFFFD"

mdempsky opened this issue · 1 comments

At least as of GCC 4.8, gccgo fails to compile string(1<<100) as "\uFFFD":

$ gccgo-4.8 -c /tmp/x.go
/tmp/x.go:6:23: error: integer constant overflow
  fmt.Println(string(1 << 100))
                       ^

http://play.golang.org/p/1s6ge-XFqd

See also #15039.

/cc @ianlancetaylor @paranoiacblack

Thanks for mentioning the version. This was fixed in 4.9 by https://go-review.googlesource.com/#/c/13906/. Please re-open if it fails there as well.